0
Why the o/p not the same?
3 Respostas
+ 4
System.out.println(i + ' ' + x[i]);
Java converted the char ' ' into its number in ASCII, a space(' ') ASCII number is 32, so it is:
0 + 32 + 0 => 32
1 + 32 + 0 => 33
2 + 32 + 0 => 34
System.out.println(i + " " + x[i]);
Java concatenate and cast operands as necessary so all the operands are treated as string.
"0 0"
"1 0"
"2 0"
Hth, cmiiw
0
Because the first does addition of the 3 values, while the second does string concatenation.
0
oh , thank you all.
I appreciate that 😁😍
Now I understood