Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- Stringa1 =newString("abc");
- Stringa2 ="abc";

if you declare like this a2 contains "abc".
again i create a string as String a3="abc";
in this time a3 object is not create.
a3 is only reference of the a2.
so if(a2==a3)
true
but in Stringa1 =newString("abc");
String a4=new String("abc");
here a4 is individual from a1.
so
if(a1==a4)
false