Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Hello

What's the difference between these two statements:
  1. Stringa1 =newString("abc");
and
  1. Stringa2 ="abc";
If you could illustrate the difference, that would be great.
No votes yet
Share this
2 answers
Raja Maragani's picture
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
No votes yet
donravi89's picture
yes mister Re:hello is correct
No votes yet