View Single Post
  #6 (permalink)  
Old 12-31-2007, 05:11 AM
CaptainMorgan's Avatar
CaptainMorgan CaptainMorgan is offline
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Quote:
Originally Posted by JavaBean View Post
Nothing different. Just syntax is different. 2 is the short hand version of 1 but does the same thing.
I'm not entirely sure this is correct JavaBean. sivasayanth, also here's the reason why

Code:
String a = new String("Java String");
Is a string object and is placed on the garbage collectible heap, while:

Code:
String a = "Java String";
is a local variable and is placed on the stack frame of the current method. I think JavaBean makes a clarification in the latest post, but I just wanted clear this up.
Reply With Quote