What will be the result of the following code execution?

String s1 = "str";
String s2 = "str";
System.out.println("Result: " + s1 == s2);
Explanation
Comparison operation has a lower priority than that of the concatenation operation.
System.out.println("Result: " + s1 == s2); 
// Evaluation flow: 
// "Result: " + s1 == s2 
// "Result: " + "str" == "str"  
// ("Result: " + "str") == "str" 
// "Result: str" == "str" 
// false

+Роман Викторович Thanks! Updated

2015 Jul 13, 2:46:34 PM

pls, add more extentnded explantion.

2015 Jul 12, 6:41:16 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback