From what I understand. When the compiler comes across this String s = "hello" it creates a string object & stores it in a string pool. But to create a StringBuffer object you have to use its contructor.
Any body else please correct me or add more explanation
Originally posted by sai murali:
Hi All,
We can create a String class as:
String s1="sample";
But we can't create a StringBuffer as:
StringBuffer s1="sample";
Can you please explain the reason for this
other than syntax.
thankyou,
saimurali