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); } }

18th Feb 2017, 3:34 AM
Kartikeya Bhardwaj
Kartikeya Bhardwaj - avatar
4 Answers
+ 2
ONE12TWOTHREE34FOURFIVE5
18th Feb 2017, 3:39 AM
Moh Affan
Moh Affan - avatar
+ 1
One12twothree34five5
18th Feb 2017, 3:37 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
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.
18th Feb 2017, 4:35 AM
Jian-hua Yeh
Jian-hua Yeh - avatar
0
a bunch of numbers
18th Feb 2017, 4:40 AM
Hyper89