aspose file tools*
The moose likes Java in General and the fly likes Creating new Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating new Strings" Watch "Creating new Strings" New topic
Author

Creating new Strings

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
String s ="abc" // Creates one String object and one reference variable. How ?

String s = new String("abc") // Creates two objects, and one reference variable. How ?

Can someone please explain the above two comments.
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

This question has been asked many times. Please SearchFirst.

A couple of threads discussing the same here and here.
Yogesh Gnanapraksam
Ranch Hand

Joined: Dec 17, 2009
Posts: 133
Also this thread could be useful
http://www.coderanch.com/t/488922/Java-General/java/new-keyword-objects-Java#2199295
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating new Strings