Tue Nov 13, 2007 10:24 pm
String str1=new String("Hello");//Using the constructor
String str2="Hello";
String str1="Hello";
String str2="Hello";
String str3=new String("Hello");
String str4=str3.intern();
if(str1==str2)
System.out.println("Equal1");
if(str1==str4)
System.out.println("Equal2");
if(str3.equals(str1))
System.out.println("Equal3");
if(str3==str2)
{
System.out.println("Equal4");
}else {
System.out.println("Not Equal4");
}
Equal1
Equal2
Equal3
Not Equal4
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.