ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1720)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (43)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (195)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (145)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
why string constant pool in java
 Question Submitted By :: Kundan Ranjan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why string constant pool in java
Answer
# 1
String constant pool is a separate block of memory where
String object are held by JVM.
If a String object is created directly by using assignment
operator(=) as
String s1="Hello";
then it is stored in String Constant pool.
One of important characteristic of String constant pool is
that it doesn’t create same String object if there is
already in the String constant pool.

String s1 = “Hello”;
String s2 = “Hello”;

For above two String objects, JVM creates only one object
in the String constant pool and for the second string
reference variable (s2) will created, it points the string
object which is created for s1. In this case, (s1 == s2) is
true.
but when we use new operator to create object then this
object will store in heap memory.. be carefull on this.
 
Is This Answer Correct ?    20 Yes 0 No
Loknathreddy
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
how to java plateform independent? TCS 5
Is there any need to import java.lang package? Sun-Microsystems 13
Is it possible to create Userdefined Unchecked Exception also?If Yes, give an example? ADP 2
what is Inheritense Tech-Mahindra 2
if arraylist size is increased from initial size what is the size of arraylist...suppose initial is 100 , if i add 101 element what is the size...   9
What is multithreading ???? How to stop multithrading in java???? Cognizent 1
What is the need of "creating and throwing an UserdefinedException" when the "Exception" class is already available?   4
Why we should declare the variables as static and final in interfaces?   1
Q) I have a ArrayList object, in that object i have added 5 integer values, 5 float values, 5 string values. Now question is how can delete particular type of data ( i.e all int values or all float values or string values) in that list object at a time? Aricent 3
String Reverse in Java...!   5
Difference String and String Buffer   4
What are Advatages of Overloading and Overridding. TCS 7
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright © 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com