Common class systems related class System class
The System class is a final class, and all properties and methods of the class are static. The properties of the system class in, out, and err correspond to standard input, standard output, and error output stream, respectively. The system class is often used to log program execution time, copy arrays, determine current system properties, and get system environment variables-Currenttimemillis () returns the current time in milliseconds. Starting from 1970/1/1 to the present
- Exit (int status) terminates the currently running Java Virtual machine
- GetProperties () Determining the current system properties
- GetProperty (String key) Gets the system properties for the specified key prompt
- Nanotime () returns the current value of the most accurate available system statistic timer, in milliseconds
- GC () Garbage collector
Many algorithms are used in garbage collection mechanism: Reference counting algorithm, search algorithm, copy collection algorithm, tag elimination algorithm, tagging algorithm, etc.
Runtime class
The runtime class represents the Java program Runtime environment, and each Java program has a runtime instance associated with it, which is connected to its runtime environment by the application. The application cannot create its own runtime instance, but the runtime object associated with it can be obtained through the static method GetRuntime () of the runtime class
Once the runtime object is acquired, it can be used to access information about the JVM, the number of processors, and the associated methods. Memory information, etc.
String-related classes
The string class contains an immutable character Hello string, String str=new String(“hello”)
or when the same type is stored, the same String str=“hello”
memory address "= =" is the memory address comparison
The string class provides a number of methods for manipulating the string object. See API
The StringBuffer object represents a variable string, and when a stringbuffer is created, it is possible to change the character sequence of the string by his method. Once the desired string is produced, you can call the ToString () method to convert it to a String object method as described in the API
JDK1.5 a new object, which also represents a string object. It is the same as string and stringbuffer in many ways, but it is thread-safe. Builder is a lightweight version of buffer for better performance
Performance: buider>buffer>string
Generally use string, often modified with buider or buffer
Java Learning (11)