- 1
Which condition are true and why?
String a=“a”; String b=“b”; String c=a+b; String d=“ab”; If(c==d){ System.out.println(1); } Else{ System.out.println(0); }
2 Respuestas
0
Hello Siddhant Saxena
I hope this post helps you to understand what == is really doing and why you should not use it to compare objects like Strings.
https://www.sololearn.com/post/171078/?ref=app
0
The answer is 0.
coz == operator is not comparing strings. To compare strings Use .equals() method instead == in if.
if(c.equals(d))