|
INTERVIEW QUESTIONS
J2EE
JAVA
DETAILS
Question: What is the difference between String and StringBuffer
Answer: String are once created, we can't modify it. Any such attempt will create a new string. In Stringbuffer one can can the insert,delete,append character after it is created. String values are resolved at compile time. So if we know the exact size of the string to be appended, better use String object. In StringBuffer values resolved at runtime, one can appened any number of String.only one StringBuffer is used to hold. No new object will be created. which is very fast
|
|
|
Category |
Java Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9124 users |
Added on |
7/14/2011 |
Views |
71213 |
Rate it! |
|
|
Question:
What is the difference between String and StringBuffer
Answer:
String are once created, we can't modify it. Any such attempt will create a new string. In Stringbuffer one can can the insert,delete,append character after it is created. String values are resolved at compile time. So if we know the exact size of the string to be appended, better use String object. In StringBuffer values resolved at runtime, one can appened any number of String.only one StringBuffer is used to hold. No new object will be created. which is very fast Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What is final class
|
View Answer
|
|
What are wrapper classes
|
View Answer
|
|
What is Singleton class
|
View Answer
|
|
What is JVM
|
View Answer
|
|
What value does readLine() return when it has reached the end of a file
|
View Answer
|
|
How you can know about drivers and database information
|
View Answer
|
|
Suppose server object is not loaded into the memory, and the client requests for it, what will happen
|
View Answer
|
|
What is difference in between Java Class and Bean
|
View Answer
|
|
Can we send object using Sockets
|
View Answer
|
|
What is marker interface?Tell name of atleast three one?
|
View Answer
|
|
How will you pass parameters in RMI. Why u serialize
|
View Answer
|
|
What is meant by Servelet. What are the parameters of the service method
|
View Answer
|
|
What is the difference in between the HTTPServlet and Generic Servlet. Expalin their methods. Tell me their parameter names too
|
View Answer
|
|
What is innerclass
|
View Answer
|
|
What is anonymous class
|
View Answer
|
|
What is the difference between Class.forName and registerDriver()
|
View Answer
|
|
What is the difference between Classpath and Import
|
View Answer
|
|
What state does a thread enter when it terminates its processing
|
View Answer
|
|
What is the range of the char type
|
View Answer
|
|
Does garbage collection guarantee that a program will not run out of memory
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Java Interview Questions & Answers - Exam Mode /
Learning Mode
|