Agree with Andre. JVM creates a string pool and basically looks/checks up the string pool before creating a string literal This will be helpful.
http://www.xyzws.com/Javafaq/what-is-string-literal-pool/3 On Wed, Nov 25, 2009 at 4:49 AM, analyn flores <[email protected]>wrote: > Which saves more memory? > > String str = ""; > or > String str = new String(); > > -- > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected]<javaprogrammingwithpassion%[email protected]> > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
