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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
String is a immutable objects . it means that string does 
not change...........
But it will be chang.........
{
String s="kapil";
String s1="raj";
String s=s1;
then print(.......)
The String has been changed ..
how it is possible and why its called immutable objects
 Question Submitted By :: Kapil Dalke
I also faced this Question!!     Rank Answer Posted By  
 
  Re: String is a immutable objects . it means that string does not change........... But it will be chang......... { String s="kapil"; String s1="raj"; String s=s1; then print(.......) The String has been changed .. how it is possible and why its called immutable objects
Answer
# 1
hi 

String is a Immutable object,that is 
string is an object not a datatype variable.

From the above example

String s=s1 //means it will create a new objet s with the 
value raj,not change the value.

Note:whenever u edit or concatinate the string internally 
it will create a new object,but not chang that object.
 
Is This Answer Correct ?    4 Yes 0 No
Ramaraju
 
  Re: String is a immutable objects . it means that string does not change........... But it will be chang......... { String s="kapil"; String s1="raj"; String s=s1; then print(.......) The String has been changed .. how it is possible and why its called immutable objects
Answer
# 2
Thank You ramaraju....
 
Is This Answer Correct ?    0 Yes 0 No
Kapil Dalke
 
 
 
  Re: String is a immutable objects . it means that string does not change........... But it will be chang......... { String s="kapil"; String s1="raj"; String s=s1; then print(.......) The String has been changed .. how it is possible and why its called immutable objects
Answer
# 3
Immutable means if you apply any methods to a String, it
would not affect the original String you created.  
For eg,

String s = "test";
s.concat(" two");
System.out.println(s);

The output is still "test" and not "test two";
Java pass by reference.  If you use = to assign the string
to another string, then the reference would change. 
Therefore your example changes the string.
 
Is This Answer Correct ?    0 Yes 0 No
Christine
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
How to eliminate duplicates from an array? Wipro3
How to add panel to a Frame?  2
What are order of precedence and associativity, and how are they used?  1
What is data abstraction? Elaborate with example? BMC3
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites. iGate2
what are class,constructor and primitive data types?  2
What is meant by controls and types?  1
what is jdk1.5 features? Virtusa2
To what value is a variable of the Boolean type automatically initialized?  3
Is it possible to create Userdefined Unchecked Exception also?If Yes, give an example?  2
When does Exception occurs?  3
I have one POJO class(Java bean class), it has two variables for that it has setters and getters. Now i have created two objects for that class and i have set the data for those variables through this two objects. Now question is i want check whether those two objects have same data or not, for this write a program? Thanks, Bose. Oracle2
What are the ways of polymorphism other than Overridding & Overloading  1
what is bytecode? watz the difference between machine code and bytecode? Oracle4
what are depricated methods in threads and explain the lifecycle methods  5
can we Connect Applet to Data Base ? with Discriptiom. and also What is Diff. from Applet & Servlet? Systematix1
When does the compiler supply a default constructor for a class? TCS8
what is the difference between abstract class and Interface?where we can use it in realtime projects? Logica-CMG10
what is the life cycle of jsp? Photon2
what is main purpose of interface? Accenture2
 
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