A brief analysis of Java reflection mechanism

Source: Internet
Author: User

First, what is reflection?

The concept of reflection was first proposed by Smith in 1982, and was primarily a capability for a program to access, detect, and modify its own state or behavior.

Second, the reflection in Java?

Reflection is one of the characteristics of the Java programming language, which allows the running Java program to check itself, or "self-audit", and to directly manipulate the internal properties and methods of the program.

Third, the class that the Java uses the reflection to use?

Each of them is:

1. Field: Provides information about the properties of a class or interface, and the dynamic access rights to it. The reflected field may be a class static property or instance property, and a simple understanding is that the class encapsulates the properties of the reflection class.

2. Constructor: Provides information about a single construction method of a reflection class and access rights to it.

3, Method: To provide information on the reflection class or an interface on one of the methods. The method that is reflected may be a static method or an instance method, including an abstract method.

4. Class: An instance of the class represents classes and interfaces in a running Java application. An enumeration is a class, and annotations are an interface. Each array belongs to a class that is mapped to a class object, and all arrays that have the same element type and number of dimensions share the class object.

A brief analysis of Java reflection mechanism

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.