How does string concatenation work here?
As the return value is of type String here, so everything should be converted to string. But why is it printing "30Good3040morning" here, instead of "1020Good3040morning". Please Help.
class StringConcatinationWorking{
public static void main(String ...args){
String s1 = 10 + 20 + "Good" + 30 + 40 + "morning";
System.out.println(s1);
}
}
Run Code Online (Sandbox Code Playgroud)