WHY STRING IS IMMUTABLE IN JAVA
Here today I will Talk about the Two important Questions for the interview first one is. Why Strings are Immutable ? What is the time Complexity of hash map ? The First One we take why Strings are Immutable ? This is the Question which is asked often why String is immutable ans is that in Java for String we have memory that is used is the String pool and a heap the heap contains the String pool. Now what is the use of String pool how it works is the other Question itself for the String pool as you write Srting str="abc"; By writing this what is the backend process .? By instantiating String and value Added is "abc" this is created in the String pool just imagine that String pool is in the heap memory and it is a block in the heap memory a large block which contains storage of String literals i.e Constants. First of all when we Write String str="abc" it checks in the pool whether the "abc" type of Sting is present or ...