what is diff string and stringbuffer

Answer Posted / sudheer babu

Both string and string buffer are different ,in the case of
the String it can ready only and immutable where as the
String Buffer is the modifier and mutable.
EX:
String s1="abc";
S.o.p(s1);---------->o/p is abc
StringBuffer sb=new StringBuffer("abc");
s.o.p(sb);---------->o/p is abc
here we can modify the String buffer values if we want i.e
sb.append("z");
s.o.p(sb);----------->0/p is abcz

"this is the basic difference between the String and String
Buffer."

Is This Answer Correct ?    8 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In hyderabad, which s/w training center is best for java, other than corejava what r the new tools to learn in java,which tool is best & have current requirement,pls give me information about java to learn ?

1685


What are maps interfaces in the java collections? : java collections

579


Explain the OOPS concept in Realtime Scenarion ? Take example as CAR. Please explain indetail ?

2572


What are the uses of the set interfaces in the java collections? : java collections

543


What are the differences between the java collection and the java list? : java collections

621






What is deque in the java collections framework? : java collections

546


What are the types of the main implementing classes in the map interfaces? : java collections

622


What are the types of java collections? : java collections

551


What is the enumerator of the java collection framework? : java collections

572


Hi Friends , am newbie to ajax. For example just consider one account registration - A form contains 8 text fields with submit button. In this form second texbox contains "username " . On right side of text box there is a label box . On clilck action i need to determine user is available or not. Is it possible on clicking label or should i click submit button.

1594


What are the interfaces in java collections? : java collections

624


please mail me the interview question based on java/j2ee

1545


Which sorting algorithm is used by collections.sort() in java ?

555


What is the difference between comparable and comparator in java.util pkg?

602


Which java collection class can be used to maintain the entries in the order in which they were last accessed?

566