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
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.
Explain 5 features introduced in jdk 1.7?
In which order the iterator iterates over collection?
How do you trim a space in java?
Difference between java and javascript
How can we make a class singleton?
What is the purpose of checked and unchecked exceptions in JAVA?
What about member inner classes?
What is hashset in java?
What are data types in oop?
What is the purpose of void?
Is multiple inheritance supported by java?
How do you do absolute value in java?
What are void methods?
What are the types of inner classes (non-static nested class) used in java?