hi...
Strings in
java, are immutable...
so for code :
String a = "hello";
String b = "hello";
Both a and b will have same reference..if string variable is not exclusively assigned memory using "new" , then JVM tries to look for string object with same value and hence b will also have same reference as a !
If the code was
String a = new String("Hello");
String b = new String("Hello");
then a == b will return false...