Originally Posted by
JavaBean
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
String a = new String("Java String");
Is a string object and is placed on the garbage collectible heap, while:
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.