ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
what is meant by string pooling?
 Question Submitted By :: Sumalatha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is meant by string pooling?
Answer
# 1
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 ?    4 Yes 0 No
Ranganathkini
 
  Re: what is meant by string pooling?
Answer
# 2
Hi... Basically string pooling is a part of the heap memory
all string literals will be storing in the string pool 
memory.
for example: String s1="DEVARATHNAM";// This is a string 
literal ,will store in the string pool .
 
Is This Answer Correct ?    2 Yes 0 No
Devarathnam
 
 
 
  Re: what is meant by string pooling?
Answer
# 3
string pooling is maintenance of pool of strings when ever 
a String Object is created one instance will be saved on 
stack and another instance will get saved on the pool.
 
Is This Answer Correct ?    1 Yes 3 No
Ravikiran
 
  Re: what is meant by string pooling?
Answer
# 4
dont misguide please, all the string objects created 
without new operator are stored in pool which is a space in 
memory, if any other object has the same content then a new 
object will not be created.
 
Is This Answer Correct ?    5 Yes 0 No
Gaurav Agrawal
 
  Re: what is meant by string pooling?
Answer
# 5
so when we use a new operator an object will be created
right and every object will be save on garbage collectible heap.
 
Is This Answer Correct ?    1 Yes 2 No
Ravikiran(aptech R&d)
 
  Re: what is meant by string pooling?
Answer
# 6
See,

String s = new String("Shiva");

Its creating two instances and one reference.

In the Two instance one is stored in Constant pool and 
another one is stored in temp' pool.

What about String s = "Shiva";

Anybody can, pls clarify...
 
Is This Answer Correct ?    0 Yes 0 No
Sivadasan
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is Distributed Application and what is its usage?  1
wht is mean by dirty read?  1
could you run the java program without main method?  1
Define interface?  2
What is the immediate parent class of the Applet class?  1
What is the superclass of exception?  2
When you say String is immutable, what do you mean by that? Say I have String s = "Ness" s= s+"Technologies"; What will happen? If the value gets appended, then what is the meaning of immutable here? Ness-Technologies4
Diff between C++ and java? TCS8
What is a thin-client application? Adobe5
Which java.util classes and interfaces support event handling?  2
what is d difference between deep cloning and shallow cloning in core java? Satyam2
what is webservices? CTS1
why the abstract class has default constructor?  1
what is difference between colection and collections? Tech-Mahindra8
what is the difference between Cpp And Java Infosys7
what is meant by serialization?  6
What are event-delegation model and event-inheritance model? Which is best?  1
what is the use of servlet engine? Photon2
how can you retrive information from database by using hashmap/arraylist ,plz explain with example briefly? Satyam1
int a=10,b=20,c=30 a= b+c;b=a+c;c=a+b; System.out.println("The value is"+a+b+c; Honeywell16
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com