Try to find out the output of this code:
public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +45+5); } }
Output:
50=455
The reason behind this is often – Initially the integers are added and we get the L.H.S. as 50. But, as soon as a string is encountered it's appended and that we get “50=” . Now the integers after ‘=’ also are considered as a string then are appended.
public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +(45+5)); } }
Output:
50=50