Description of the software package java. lang: provides basic classes for Program Design Using Java programming language. The most important Class is Object (it is the root of the Class hierarchy) and Class (its instance represents the Class in the running application ).
It is usually necessary to regard the value of the basic type as an object. The wrapper type Boolean, Character, Integer, Long, Float, and Double are used for this purpose. For example, an object of the Double type contains a field of the double type. This indicates that if a value is referenced, the value can be stored in the variable of the reference type. These classes also provide a large number of methods for converting the base value and support some standard methods, such as equals and hashCode. The Void Class is a non-instantiated Class that maintains a reference to the Class object that represents the basic type of void.
Math provides common mathematical functions, such as sine, cosine, and square root. Similarly, the String and StringBuffer classes provide common String operations.
Class ClassLoader, Process, Runtime, SecurityManager, and System provide "System operations" such as dynamic loading of management classes, external Process creation, host environment query (such as time), and security policy implementation ".
Class Throwable contains objects that may be thrown by the throw Statement (§ 14. 16 ). The subclass of Throwable indicates errors and exceptions.
Read the specific meanings of the Class! The following is a description of the javaAPI documentation:
An instance of the Class indicates the classes and interfaces in the running Java application. Enumeration is a type, and annotation is an interface. Each array is a Class mapped to a Class Object. All arrays with the same element type and dimension share the Class object. Basic Java types (boolean, byte, char, short, int, long, float, and double) and keywords void are also represented as Class objects.
Class does not have a public constructor. The Class object is automatically constructed by the Java Virtual Machine during Class loading and by calling the defineClass method in the Class loader.
The following example uses a Class object to display the Class name of an object:
Void printClassName (Object obj ){
System. out. println ("The class of" obj
"Is" obj. getClass (). getName ());
}
You can also use a Class literal (JLS Section 15.8.2) to obtain Class objects of the naming type (or void. For example:
System. out. println ("The name of class Foo is:" Foo. class. getName ());