Awesome explanation of String internals in Java with memory concept!
There are two ways to create String object:
By string literal
By new keyword
String Constant Pool is a collection of references to String objects.
Strings, are immutable, are objects like any other in Java. Objects are created on the heap and so are Strings.
So, Strings that are part of the String Literal Pool live on the heap, but they have references to them from the String Literal Pool.
When a .java file is compiled into a .class file, any String literal is noted in a special way.
On finding one, it checks to see if an equivalent String is already referenced from the heap.Once a reference is made to that String object, any references to that String literal throughout the program are replaced with the reference to the object referenced from the String Literal Pool.
On this page of the site you can watch the video online String in Java - Never like before! with a duration of hours minute second in good quality, which was uploaded by the user Sudipto Roy 17 February 2018, share the link with friends and acquaintances, this video has already been watched 239 times on youtube and it was liked by 7 viewers. Enjoy your viewing!