Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is meant by string pooling?

Answer Posted / ranganathkini

A string pool is a collection of references to String
objects. Strings, even though they are immutable, are still
objects like any other in Java. Objects are created on the
heap and Strings are no exception. So, Strings that are part
of the "String Literal Pool" still 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
literals are noted in a special way, just as all constants
are. When a class is loaded (note that loading happens prior
to initialization), the JVM goes through the code for the
class and looks for String literals. When it finds one, it
checks to see if an equivalent String is already referenced
from the heap. If not, it creates a String instance on the
heap and stores a reference to that object in the constant
table. Once a reference is made to that String object, any
references to that String literal throughout your program
are simply replaced with the reference to the object
referenced from the String Literal Pool.

Is This Answer Correct ?    37 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you write a scanner class in java?

950


What is space character in java?

1036


Which method cannot be overridden in java?

945


Can you explain the private protected field modifier?

966


Which arithmetic operations can result in the throwing of an arithmeticexception?

970


Can we increase array size dynamically in java?

896


What is public static?

976


What is the maximum size of hashmap in java?

935


How many types of memory areas are allocated by jvm?

975


Can we create object of inner class in java?

881


What is the use of object and class classes?

991


what are three ways in which a thread can enter the waiting state? : Java thread

947


What is the meaning of variables in research?

976


How do you declare a string variable?

955


What is meant by inheritance and what are its advantages?

1039