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

What are the classes in the java collection framework? : java collections

589


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

558


What is an algorithm in java collection framework? : java collections

573


Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.

1592


can u draw class/object diagram for ATM

5527






What are the types of interface used in the java collections? : java collections

584


What are the main classes of the list interfaces? : java collections

574


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

561


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.

1579


How do I find jre path in windows?

521


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

585


Should we create system software ( e.g operating system ) in java ?

573


What are the different types of features of the java collections framework? : java collections

566


What do you understand by synchronization? Why is it important?

566


Hi Friends, i have searched in google but not clear. can you give bank example with synchronized keyword

1608