A StringBuffer is similar to a String with a few differences:
String class is useful to accept inputs from commands prompt as string arguments
String is the immutable class that means the object f that class never be changed. String is the Sequence of character.
yes
define class string
A string is a specific class that is used for dealing with text data
An object is created from a class, like a house made from a blueprint. The object will therefore be of the type of its class. For instance, a String object will be of type String, which is defined by the String class.
public class Test { public static void main(String[] args){ String str = new String("Rocky"); String str1 = "Rocky"; StringBuffer sb = new StringBuffer(); sb.append("Rocky"); String str2 = new String(sb); } } Above are three commonly used ways of creating Strings. Apart from you you can also pass byte arrays and character arrays as arguments to the String constructor
Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and manipulate strings. Creating Strings The most direct way to create a string is to write: String greeting = "Hello world!"; In this case, "Hello world!" is a string literal-a series of characters in your code that is enclosed in double quotes. Whenever it encounters a string literal in your code, the compiler creates a String object with its value-in this case, Hello world!. As with any other object, you can create String objects by using the new keyword and a constructor. The String class has 11 constructors that allow you to provide the initial value of the string using different sources, such as an array of characters: char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.'}; String helloString = new String(helloArray); System.out.println(helloString); The last line of this code snippet displays hello. Note: The String class is immutable, so that once it is created a String object cannot be changed. The String class has a number of methods, some of which will be discussed below, that appear to modify strings. Since strings are immutable, what these methods really do is create and return a new string that contains the result of the operation.
The String class has multiple Constructors. Some of them are: 1. String - new String(String val) 2. Character Array - new String(char[] array) 3. Character Array with index positions - new String(char[] array. int start, int end)
str.endsWith(string)
You can use "string" class in C++ for string operations or you may use c style string functions as well. #include <string> String class in C++ provides all basic function to operate on strings. you may details descriptin at http://www.cplusplus.com/reference/string/string/
StringBuffer is java class available in java.lang package which provides mutable String object where String is immutable class. The methods of this class like reverse(), append(),insert() gives facility to insert data of the same object.