System.out.println(100 + 100 +"Simplilearn");
System.out.println("E-Learning Company" + 100 + 100);
output:
200Simplilearn
E-Learning Company100100;
System.out.println(100 + 100 +"Simplilearn");
System.out.println("E-Learning Company" + 100 + 100);
output:
200Simplilearn
E-Learning Company100100;
Javas behavoiur is to interprete your given values.
Your cases: 1)
System.out.println(100 + 100 +"Simplilearn");
100 is an integer, so Java interprets the "+" as arihmetic operator. 100 + 100 equals 200.
The next "+" cant be of arithmetic type, because of "Simplilearn" wich is an String.
2)
System.out.println("E-Learning Company" + 100 + 100);
If you give Java an String at first (same is if you youse this as variable value), Java interprets the whole line as String. This is because "+" can“t be an arithmetic type, when the previous is a string.
So for Java your Output equals "E-Learning Company100100".