+ 15
String concatenation in Java
Why is the output 3solo12? How does it work actually? System.out.println(1+2+"solo"+1+2);
4 odpowiedzi
+ 5
because you are making an output (reading ltr due to operator priorities) start as an int, convert to string, and attempting to convert back which a string even as a priminitve cannot turn into an int. to accomplish 3solo3 you would have to put parentheses around the last 1+2 to have that calculated first, same as if you used multiplication in the middle
+ 12
Now I got it, thanks for the explanation :)
0
concatenation means combining of the given message (or) string.
ex: System.out.println("a+bc+c");
output: abcc
0
thanks for everything b.sruthireddy