This article has been dead for over three months
You
public class Demo {
public void demonstration(){
System.out.print("Case 1 : ");
System.out.println(2 + 2 + "Output");
System.out.print("Case 2 : ");
System.out.println("Output" + 2 + 2);
}
public static void main(String[] args) {
new Demo().demonstration();
}
}
/*
Output :
==================
Case 1 : 4Output
Case 2 : Output22
Answer :
==================
In the first case, It sums two integers : 2+2=4 and then converts it to a string: 4Output
In the second case Java takes string ” Output ” then converts 2 to a string, concatenates them together. Then this process repeats with next number… Finally we get: Output22
*/