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

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты