Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners String and stringbuffer object
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Deepak Kumar
String and stringbuffer object
2 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners


Hi,

What is the basic difference between string and stringbuffer object?

Thanks

Advertisement
View Answers

October 5, 2010 at 5:54 PM


Hi Friend,

Differences:

1)String class is used to manipulate character strings that cannot be changed while StringBuffer class is used to represent characters that can be modified.

2)StringBuffer is faster than String.

3)String Objects are constants and immutable while StringBuffer objects are not.

4)StringBuffer is threadsafe while String is not.

Thanks


September 23, 2012 at 2:13 PM


StringBuilder is great for creating main String from temporary Strings. Also concatenation operator ( +) is replaced by either buffer or builder as discussed in.



Related Tutorials/Questions & Answers:
String and stringbuffer object - Java Beginners
String and stringbuffer object  Hi, What is the basic difference between string and stringbuffer object? Thanks   Hi Friend... be modified. 2)StringBuffer is faster than String. 3)String Objects
String and StringBuffer - Java Beginners
; Hi vijay Java provides the StringBuffer and String classes.... Simply stated, objects of type String are read only and immutable. The StringBuffer... than String when performing simple concatenations. StringBuffer is mainly
Advertisements
'String' vs 'StringBuffer' - Java Beginners
'String' vs 'StringBuffer'  What should i use String or StringBuffer... a new object is created for each concat operation. So it is better to use StringBuffer when you are append different data to the same StringBuffer object
StringBuffer
StringBuffer  What's the difference between these two formats? String string=args[0]; String reverse = new StringBuffer(string).reverse().toString(); String string=args[0]; StringBuffer rev = string.reverse(); String
Differences between the String, StringBuilder, and StringBuffer classes
on the StringBuffer object, it must be converted back into a String... a new String object from the temporary StringBuffer object. The creation... A StringBuffer object at location 10 A String object at location 26 Now, let
string object
string object  Hi, how do i write a program that works with a user's password, when the program should prompt the user for a possible password, that is between 6 and 10 characters long, that contains at least one letter
StringBuffer and StringBuilder
StringBuffer and StringBuilder  package org.day.strings; import java.io.BufferedReader; public class Test { public static void main(String[] args) { StringBuffer sb1 = new StringBuffer(); sb1.append
StringBuffer related.
StringBuffer related.  how to make StringBuffer as immutable
object 2 string - Java Beginners
object 2 string  hi sir,how to convert object to string and how 2 compare object with null value to string with null value plz provide a program 4 this sir,plzzzzzzzzz
Convert Object To String
Convert Object To String       In this section, you will learn to convert an object to a string... in converting an object type data into a string type data. The toString() method
Converting object to String
Converting object to String In this section you will learn to convert Object to String in java. It is sometimes necessary to convert object to String because you need to pass it to the method that accept String only. Object is a class
stringbuffer - Java Beginners
DeleteString { public static void main(String args[]) { StringBuffer sb = new StringBuffer("Rose India Tech"); //Removes the characters at index 10 to 15 in the StringBuffer. sb.delete(10, 15); System.out.println("After delete
Convert an Integer type object to a String object
Convert an Integer type object to a String object   ... the Integer type object to a String object using the Integer.toBinaryString...; Create a class "NumberFormats" where an integer type object is converted
Object representation in to String example
.style1 { font-size: medium; } Object representation in to String example:- We can represent any kind of object in the form of string. For this purpose we have used toString() method for any kind of object. User can see
StringBuffer - Java Beginners
question regarding StringBuilder And StringBuffer. But,while using more than one...-threaded applications(i.e. StringBuffer)? Please give example(code) and explain   Hi public class MultiTread implements Runnable{ private String name
StringBuffer - Java Beginners
StringBuffer  Can any one help with this naughty problem? Replacing a character with two characters in a StringBuffer. Replacing a character...;} converting the StringBuffer using charArray[] also worked well, but not where
Java date to String, Convert date object into a string with a pattern
Convert date object into a string with a pattern This section illustrates you the conversion of date object into a string pattern. Java has provide many... string. For example, d -  denotes the day in month M- denotes the month
StringBuilder v/s StringBuffer - Java Beginners
class and it's functions."); //Create a object of StringBuffer class... between StringBuilder & StringBuffer classes. I know that StringBuffer... often causes many temporary string objects to be created, which can be quite
how to convert xml string to soap request object using axis1.4?
how to convert xml string to soap request object using axis1.4?  how to convert xml string to soap request object using axis1.4
I retrieve a String or other object type without creating a new object each time.
I retrieve a String or other object type without creating a new object each time.  How can I retrieve a String or other object type without creating a new object each time
Java - StringBuffer class in Java
; StringBuffer is mainly used for the dynamic string concatenation which... Java - StringBuffer class in Java       In this example you will learn about StringBuffer
ReadLine(String fmt,Object... args) of Console class - Java Beginners
ReadLine(String fmt,Object... args) of Console class  How to reload the string and objects of console class in Java?  Hi friend,import... ConsoleExample{ public static void main(String[] args){ Console console
Creation of StringBuffer
Constructor with 16 characters set StringBuffer(String s) //String to String... the String buffer and capacity of StringBuffer. Therefore we get the following... Creation of StringBuffer      
StringBuilder v/s StringBuffer - Java Beginners
Character!"); String st = buff.readLine(); StringBuffer sb =new.... String str; int a = 42; StringBuffer buffer= new StringBuffer(40); str...... Threads run simultaneously. But in case of BOTH StringBuilder & StringBuffer
String reverse in java
String Buffer "); String reverses = new StringBuffer(word1).reverse...String reverse in java In this section we are going to discuss about how to reverse a sting in java. There are many ways to reverse a string in java 
object
object  is it possible to create object in the same class..?.   Yes, you can. class CreateObject { CreateObject(){ System.out.println("I have an object."); } public static void main(String[] args
(ii) String and String Buffer Class
between String and StringBuffer 1) String object is immutable whereas StringBuffer objects are mutable. 2) String objects are constants...String and String Buffer Class  difference between String and String
Java string buffer
Java string buffer  What is the basic difference between string and stringbuffer object
String intern()
() method returns a standard form representation of a string object. Basically... already contains a string equal to this String object as determined by the equals(Object) method then on invoking the intern method the string from the pool
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object...(String[] args) { Date date=new Date(); SimpleDateFormat sdf1
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object...(String[] args) { Date date=new Date(); SimpleDateFormat sdf1
 

 

 

DMCA.com