Java. lang

Source: Internet
Author: User

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 ());

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.