Difference between String & StringBuffer
Answer Posted / nilesh bhil( mca) amravati
String is immutable.
It means that we cant change the content of String once created. If we try append a new string using + operator
then it creates new String object.
ex.
string s = new String("Java");
s = s + "bean" ;// this statement creates new object.
String class does not have method that append new String to old String in object.
where as StringBuffer class is mutable. It means that we can add new String to it using append() method.
ex.
StringBuffer sb = new StringBuffer("Java");
sb.append("Bean");
| Is This Answer Correct ? | 38 Yes | 3 No |
Post New Answer View All Answers
which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com
What is class forname used for?
What is double checked locking in singleton?
Explain the difference between abstraction and encapsulation.
How many bits is a char?
what is the major difference between linkedlist and arraylist in java?
What are the basic control structures?
What is natural ordering in java?
What are the differences between c++ and java?
What is re-factoring in software?
What is difference between local variable and global variable?
In which language java is written?
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What is an infinite loop?
What is callablestatement? How you can call stored procedure to pass in parameter?