There are two types of "+" operators in the operator, one of the String objects and one of the Integer object:
String s = 10 + 30 + "Sachin" + 40 + 40;
First the operation "10 + 30" is applied. Let's look at the value "10", this is interpreted by the Integer object, which activates the + operator by the value "30", which is obtained as an integer 40.
The next operation is the last result of 40 with "Sachin": 40 + "Sachin". An Integer object that activates the + operator on a String object that outputs the String object "40 Sachin".
The next operation is the last String String ('40 Sachin ') object, which adds an Integer 40, which results in a "40 Sachin 40".
In the same way, adding the last β40β, which ultimately results in a '40 Sachin 4040 '.
source share