The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Re: why String objects get created without new and constructor

Posted by Kishori Sharan on November 30, 2000 at 4:30 PM

Use of String class is so frequent in java that Java Creator gave us a shortcut to create a String object without using new operator. That's it.
String str = "abc" ;
and
String str = new String ( "abc" ) ;
are same. ( In fact there is some differences in two statements, but I am not going to mention those because you didn't ask for that ) .

Thanx
Kishori



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us