For Example..
String herName = new String("clark");
and
String hisName = "michal";
1) The first piece of code exactly does, it will create new string
object in the heap memory with reference .
2) The second line of code , its an string literal which create
string object in string constant pool, not in actually heap memory.
Then what's the benefit, ?
No comments:
Post a Comment