Java Reflection mechanism

Source: Internet
Author: User

The Java reflection mechanism is in the running state, for any class, can know all the properties and methods of this class, for any one object, can call any of its methods and properties; This dynamically acquired information and the ability to dynamically invoke the object's methods are called the reflection mechanisms of the Java language.

Dynamic language means that a program can change its structure at run time: New functions can be introduced, existing functions can be deleted, and so on structure changes. For example, the well-known ECMAScript (JavaScript) is a dynamic language. In addition, such as Ruby, Python and so on are also dynamic languages, and C, C + + Java and other languages are not dynamic language.

The class class is constructed by private, which is created by the JVM.

Reflection is a feature of the Java language that allows programs to self-check and manipulate internal members at runtime (note that it is not compiled). For example, it allows a Java class to fetch all of his member variables and methods and display them. This ability of Java may not be used much in practical applications, but it does not exist in other programming languages at all. For example, there is no way to get information about a function definition in a program in Pascal, C, or C + +. (from Sun)

JavaBean is one of the practical applications of reflection, which enables some tools to visualize the operation of software components. These tools dynamically load and get the properties of the Java component (Class) through reflection.

Reference Blog: http://www.cnblogs.com/hxsyl/archive/2013/03/23/2977593.html

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.