Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Can String Buffer has a String constant pool in java?

user-image
Question ajoutée par Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date de publication: 2013/11/21
Vivek Dudani
par Vivek Dudani , Software Engineer / Senior Software Engineer , Mastercard

The answer is no. The whole idea behind using String Buffer is not to use string pool as that will make it behave like a normal String class if it uses string pool. String Buffer creates a new object in Heap.

pardeep kumar
par pardeep kumar , Senior R & D Engineer , Mavenir Systems

No,  String buffer do not have a String constant pool because String buffer is mutable class.

Where as String has constant pool because it is immutable in java.

More Questions Like This