Saturday, March 30, 2019

What is the difference between implicit and explicit String declaration in java?

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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...