String is a lang package in java. It's final class so immutable.
String object created two ways
1. using "new" keyword ----> It's store the normal memory.
2. reference variable ----> It's store the string pool.
point : 1
----------
String s1=new String("java");
s1 reference variable refer the object1 ['java']
if we change the s1 object1
for example
s1=s1.concat("program");
create the new object
No comments:
Post a Comment