Javatpoint Logo

== compares reference address.

By: swetha*** On: Wed Jan 25 12:33:01 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
String a ="meow";
a = a +"deal";
String b = "meowdeal";
if(a==b)
System.out.println("true");
else
System.out.println("false "+a.hashCode()+" b hash "+b.hashCode());


Here b should contain same reference as a.then if should be executed.but y else condition is getting executed.Please explain
Up0Down