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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  Java J2EE AllOther
 
 


 

 
 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 diff string and stringbuffer
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is diff string and stringbuffer
Answer
# 1
string is immutable, that is it can not be extended.whereas
StringBuffer is mutable and can be extended.
Fro example :
  Consider 2 statement : "Welcome "  and "to Java World".
 now assign first statement to string and string buffer.
  String str = "Welcome" & StringBuffer strBuff = new
StringBuffer("Welcome");
  Now if we add 2nd statement to both then :
  str= str + "to Java World" -> In this case, it would dump
all the memory allocated with "welcome" and allocate a new
memory space to the entire string "Welcome to Java World"  .
On the other hand, in strBuff  :-
  strBuff.append("to Java World") -> if simply allocate a
new memory space to only 2nd statement and add to link to
previous name.
 
Is This Answer Correct ?    1 Yes 1 No
Monika
 
  Re: what is diff string and stringbuffer
Answer
# 2
String is immutable that once the value assigned to object 
cannot be modified.Suppose if we want to perform 
concatenation another string object will be prepared and 
the value is going to assign for that object.in total we 
are having 2 objects

StringBuffer is Mutable we can change the value of the 
object even the value is assigned to the object.
 
Is This Answer Correct ?    1 Yes 0 No
Gayathri
 
 
 
  Re: what is diff string and stringbuffer
Answer
# 3
Simple Example for String And String Buffer.

String must allow the declared memory space to the variable.

String Buffer automatically increase the Exists memory space
 
Is This Answer Correct ?    0 Yes 0 No
Kesavaraj
 
  Re: what is diff string and stringbuffer
Answer
# 4
String is Immutable and String buffer is mutable.
Inside String.java, equals() method is overrideen but not 
the case in StringBuffer.

This all is the simple.
 
Is This Answer Correct ?    0 Yes 0 No
Rohit Aggarwal
 

 
 
 
Other Java J2EE AllOther Interview Questions
 
  Question Asked @ Answers
 
what is hibernate ceteria ? Fidelity3
whatis arguments &what is default argument CTS1
which book is the best for preparing for SCWCD 1.5 Google2
How to implement or use the singleton class in java?  2
what is the IDE that you have used to write your java programs? Inforica2
How do you create UserTransaction Object? How do you rollback a transaction in a method? HCL1
What is the use of log4j and how to make use of that in a application?  1
VSS Objectives  1
httt method HCL1
What is a constructor?  2
what is the difference between banking and insurance domain?  1
what is difference between business deligate and session facade ? Fidelity2
what debugging tool that can be used to debug the java programs? Inforica1
what is difference between vector and arraylist?. HCL2
what is diff string and stringbuffer HCL4
what is class/object diagram Zycus-Infotech1
What is an Ioc pattern? There are assemblies in .net for establishing this task, Whats the special in Java /j2ee technologies about IOC  2
wnet use DAO design in u r project? Godrej1
where is JNDI being used in java platform?  2
whats the relation ship between LDAP and JNDI?  1
 
For more Java J2EE AllOther Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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