A Practical class

Source: Internet
Author: User

The class fully qualified name is java.lang.Class
The class class object stores the classes ' fully qualified name, attributes, methods, and parent classes of the other class.
Suppose a class A is defined,
When creating a Class A object, you also create an object of class.

AA();

When creating a Class (a) object, the Java platform automatically creates a class object for the object (note that the class object entity is not assigned to a class class reference) and the class object stores some information that describes class A. Then you can use this information in your code to judge.
Because the class object entity is not assigned to a class reference that is available to our program, use the GetClass () method provided by the object class to return the class class instance for the object entity of type A, and then assign the value to the class reference.
1, you can do the following

class =a1.getClass();

2. Then call the method provided by Class GetName ();

Stringclass.getName();

This returns the fully qualified name of the Class A, which is known to call this method.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

A Practical class

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.