*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes string object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

string object

arivu mathi
Ranch Hand

Joined: Jun 26, 2006
Posts: 38
String s = new String("abc");
String s = "abc";

will the above two statements create a new string object?
what is the difference between the two statements?
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by arivu mathi:
String s = new String("abc");
String s = "abc";

will the above two statements create a new string object?
what is the difference between the two statements?


I am sure that you haven't visited JAVA Ranch Properly...

Check this out..
Strings, Literally- JAVA Ranch.

This link will be usefull for you...

For more check out this also..

Java Beginners Faq


The Best way to predict your future is to create it - Every great individual common man
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
We seem to be having a leetle problem with the bulletin board at the moment. I'm closing this one for now - it looks like a double post but it is not intentional.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
Don't get me started about those stupid light bulbs.
 
subject: string object
 
Similar Threads
Difference between s = "" and new String("a")
A question about Garbage Collection!
why we r not using 'new' for String declaration
Difference between String
String assignment