+ 1

Can anyone explain this to me

int x = 1 int y = 2 string s = "+x+y+(x+y); system.out.println(s);

8th Jan 2017, 3:15 PM
Rajat Samuel
Rajat Samuel - avatar
1 Answer
+ 1
123 () first and from left to right with type casting s = "" + 1 + 2 + (1+2) s = "" + 1 + 2 + 3 s = "1" + 2 + 3 s = "12" + 3 s = "123"
8th Jan 2017, 3:19 PM
Peter Chei
Peter Chei - avatar