Javatpoint Logo

Core java String topic

By: sr.bho*** On: Wed Apr 12 15:00:50 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
if i create string literal and string by new keyword of same string,then the will both create in same loacation i.e string constant pool or heap area.

ex:-
String s3=new String("example");
String s4="example";
Up0Down

 
When u create a object using new keyword the memory allocated in heap area in two different area one is in String Constant Pool and 2nd is In String Non-Constant Pool.
but its Object Store iN stack Area.

In String Literal the object will point to String Constant Pool.
Image Created0Down

By: [email protected] On: Thu Apr 13 22:00:01 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No