filmov
tv
Why string is immutable in java || The 4 reasons you must know || part 1
Показать описание
Well, Why String pool? What is the need of String pool in java? How is string being an immutable class helping us optimizing the memory uses in java?
That's what we are going to learn in this tutorial.We are going to cover one of the most common FAQ why String is immutable in java? There is not a single reason for this.String class is designed as an immutable class by keeping different things in mind.Today we are going to cover one of the most important reasons why the string is immutable.
Immutable classes object doesn’t change their state.The string being immutable can’t be modified once string object is created.One of the reasons why it is possible to have a string pool inside the heap memory.In string pool, once an object is created, it is cached in the memory.After that, no object with the same content will not be allowed to the string pool as duplicates are not allowed inside string constant pool.Multiple strings can be referred to the object which been created inside the string constant pool which helps us to optimize memory and help us to stop creating tons of object.
String pool implementation is one of the biggest reason why the string is immutable in java.
We are also going to learn about how to intern an object inside string pool in this tutorial.
In the next video, we are going learn about one of another reason why the string is immutable.I am talking about string hashcode caching here.The reason why we can use string a key in the hashmap.
Below link will redirect you the next tutorial
String hashcode caching (One of the biggest reason why the string is immutable)
subscribe to my channel by clicking on the link below.
Stay tuned and like my Facebook page for more.
Music :
-----------
credits : -
(intro)
1)
Creative Commons — Attribution 3.0 Unported— CC BY 3.0
-----
intro template :
That's what we are going to learn in this tutorial.We are going to cover one of the most common FAQ why String is immutable in java? There is not a single reason for this.String class is designed as an immutable class by keeping different things in mind.Today we are going to cover one of the most important reasons why the string is immutable.
Immutable classes object doesn’t change their state.The string being immutable can’t be modified once string object is created.One of the reasons why it is possible to have a string pool inside the heap memory.In string pool, once an object is created, it is cached in the memory.After that, no object with the same content will not be allowed to the string pool as duplicates are not allowed inside string constant pool.Multiple strings can be referred to the object which been created inside the string constant pool which helps us to optimize memory and help us to stop creating tons of object.
String pool implementation is one of the biggest reason why the string is immutable in java.
We are also going to learn about how to intern an object inside string pool in this tutorial.
In the next video, we are going learn about one of another reason why the string is immutable.I am talking about string hashcode caching here.The reason why we can use string a key in the hashmap.
Below link will redirect you the next tutorial
String hashcode caching (One of the biggest reason why the string is immutable)
subscribe to my channel by clicking on the link below.
Stay tuned and like my Facebook page for more.
Music :
-----------
credits : -
(intro)
1)
Creative Commons — Attribution 3.0 Unported— CC BY 3.0
-----
intro template :
Комментарии