The string from the surface, is the data between the quotation marks, such as "www.weixueyuan.net", "micro-school", "C + + Introductory tutorial" and so on. In Java, the string processing class library uses the most of the two types:the "string" Class and the "StringBuffer" class .
Note: If you are working with some small text, it is recommended to use the "String" class, which is particularly handy. If you use the String class to work with large text, you consume system resources, so the Java programming language specifically introduces the "StringBuffer" class.
The "string" string has one thing in common with the array learned in the previous chapter. Is that they are initialized, the length is constant, and the content is unchanged. If you want to change its value, a new string is generated, as follows:
String str1= "very";
str1=str1+ "Good";
This assignment expression looks a bit like a simple solitaire. Add a "good" string immediately after "str1" to form the final string "very good". It works like this: The program first produces a "str1" string object and requests a space in memory. It is not possible to append a new string, since the string is initialized and the length is fixed. If you want to change it, only discard the original space, re-apply to accommodate "very" and "good" two strings of memory space, and then put the "very good" string into memory.
Here is a simple introduction to the string, the simplest way to declare a string. Other operations on strings are explained in detail when it comes to the "string" Class and the "StringBuffer" class.
8.Java String Overview