0

Problem help

int i = 6, j = 4 String s = Integer.toString (i); String t = s + j; Can somebody explain how to do this problem? Thanks. I think the answer is 64??

20th Apr 2017, 1:00 AM
Philip
2 Answers
+ 5
you are missing a semicolon after "int i = 6, j = 4" "int i = 6, j = 4;"
20th Apr 2017, 1:04 AM
Tim G
Tim G - avatar
+ 1
Yes, in the third line a variable t of string type is assigned with the value "64". Before performing the operation of concatenating the values of the variables s and j, an implicit type cast of the value 4 of integer type of the variable j to the value "4" of string type is made. And of course the first line must end with a semicolon character.
20th Apr 2017, 9:47 AM
Дмитрий Ловянов
Дмитрий Ловянов - avatar