The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000



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.


why String objects get created without new and constructor

Posted by saddy on November 30, 2000 at 1:27 PM

Why the objects of String class get created without new and constructor. i.e.

String s = "Hello world";

works fine and we can use all the methods defined in String class on the object s, thus the object is created but what i learned was that the "new" operator allocates memory and constructor initialzes or construcs the object but in this case both are missing, i am really confused so please help me out


Sponsored Links

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