How JVM creats String object

#1
we create objects in fore ways...
1)By using new operator.
2)Factory methods.
3)class.forName();
4)cloning mechanism.
but when we write String s="shekar";
how the object is create...
is jvm use another way
 
#2
When JVM find String object to be created as String s = "chetna", then it does not create this object in heap memory rather it puts this object into the String pool.String pool is managed by String class.
 
Top