+ 2
How does this code works String res=""+2+(4%2)+(5%2)+7; System.out.print(res); Output: 2017?
4 Answers
+ 3
Ok thanx :)
+ 2
But 2, 0, 1 and 7 are not strings so why don't it gives an error?
+ 1
If I put String res = ""+hello; It gives an error saying hello is not recognised.
+ 1
Was this("") intentionally made to convert other types into string by using concatenation or did someone just found it accidentally that concatenating any other data type with "" will convert it into string?