hi
String s="hello"; is a string literal.
String s=new String("hello"); is an object.
there is difference in these two initializations..
In
Java if two string literal are same then they point to the same memory location...for example..
String s="hello";
String s1="hello"; are equal...when u compare like (s==s1)..they print "true"...but the same thing is false if two String object are compared...for example
String s=new String("hello");
String s1=new String("hello");
they print "false" when compared like this(s==s1)
becuse == refers to the memory locations...
this site will clarify ur doubts..
"http://java.sun.com/docs/books/tutorial/java/data/stringsAndJavac.html"
hope this answer clear's ur doubts
ganapathy