0
What will be the output of the following program?
public class MainClass { public static void main(String[] args) { String s = "ONE"+1+2+"TWO"+"THREE"+3+4+"FOUR"+"FIVE"+5; System.out.println(s); } }
4 Answers
+ 2
ONE12TWOTHREE34FOURFIVE5
+ 1
One12twothree34five5
0
ONE12TWOTHREE34FOURFIVE5
The reason of the above output is type conversion. The first data type is String, so all the addition operations become string concatenation.
0
a bunch of numbers