Java Interview Questions And Answers When to use Java Reflection API in your application

preview_player
Показать описание

Reflection is a feature in the Java Programming language.It allows executing Java program to examine or "introspect" upon itself,and manipulate internal properties of the program.For example it is possible for a Java class to obtain the names of all its members and display them.

The ability to examine and manipulate a Java class from within itself may not sound like very much ,but in other programming languages this feature simply doesn't exist.C,C++,etc

The reflection API represents,or reflects, the classes,interface, and objects in the current Java Virtual Machine.

With reflection API you can :

Determine the class of an object.

Get information about a class's modifiers,fields,methods,constructors,and superclasses.

Find out what constants and method declarations belong to an interface.

Create an instance of a class whose name is not known untill runtime.

Get and set the value of an object's field,even if the field name is unknown to your program untill runtime.

Invoke a method on an object,even if the method is not known untill runtime.

A Job Portal

Other Top Job Portals

Are you looking for a new Job ?
Рекомендации по теме