Java string
The Java language itself does not provide a string type, and the string in Java is a predefined class that is provided in the standard class library to represent strings, both string classes. A Java string is a sequence of Unicode characters (char represents a Unicode character and is two bytes in size).
The string object can intercept the substring through the substring method, while the "+" can be used to stitch the string, but string is an immutable string, and the result of the concatenation is just a new string created. Any object in Java can be converted to a string (the ToString method is defined in the object class). The Java string itself cannot be changed, but the string is referenced by a String object variable, which can be changed to the content referenced by the variable. Using the concept of shared strings in Java, a variety of strings are stored in common storage pools, and string variables point to locations in the storage pool. When you copy a string, it points to the same location as the original string.
The string object comparison cannot use "= =", which can only be used to determine whether two string variables point to the same string. You need to use the equal method when you need to determine whether content is equal. When you need to use characters to make a string, you need to use StringBuilder, you can stitch the characters by using the Append method, and finally return the string object using the ToString method.
Java input and output
Input and output in Java uses the concept of flow, and both standard input and output and file input and output need to be converted to streams first. For standard input and output, Java provides two objects system.in and System.out to handle. For System.in objects, you need to bind a scanner object to handle the standard input. For standard output, you can use the various methods of the System.out object directly for standard output. The printf method can be used to format the output, and the formatted output method is basically the same as that of a/C + + format output. For file input and output, there are a variety of methods, focusing on figuring out the various stream processing methods in Java.
Control processes and large values
The control flow in Java is nothing special compared to C + +, only the foreach operator, which is more convenient and secure than the FOR Loop statement. In addition, the case label in the switch language in Java can be char,byte,short,int or its wrapper type, as well as the enumeration type. Starting with the Java SE 7 version, it can also be a string literal.
Two large numeric types, BigInteger or BigDecimal, can be used when the basic integer and floating-point precision cannot meet the requirements. However, it is not possible to use the "+" or "-" operators directly on either of these types, and these two types of methods need to be used to implement the add and subtract operations.
Array
An array in Java is also an object, so an array object can be referenced by an object variable, so the array variable is assignable in Java, and the array variable is assigned to a new array
Basic program Design Structure of Java (II.)