Java Reflection mechanism

Source: Internet
Author: User

Java Reflection mechanism: dynamic (runtime) Gets the information in the class is the Java reflection, can be understood as the anatomy of the class.

The reflection mechanism provides the main functions :

1) Determine the class to which any object belongs at run time

2) Constructs an object of any class at run time

3) Determine the member variables and methods that any one class has at run time

4) method of invoking any object at run time

The role of reflection technology: Improve the scalability of the program

Example : Tomcat uses the reflection mechanism to read all the methods in the Servlet class developed in the Web. XML configuration file, thus implementing a specific method of processing requests and corresponding (Response) (methods provided by the Web program developer, equivalent to extending the Tomcat program).

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.