In this section you will learn,
how to
retrieve the information about the constructor by using the
getConstructors() method. Here is an example that provides the
usage of the getConstructors() method.
Declare a class "Fconstructor" and
then create an object of this class and take the reference of the class java.util.Integer.class
into it.
Make a Constructor named constructor. Now retrieve the name of the
constructor by using the getConstructors() method.
Here is the code of the Example :
Fconstructor.java
import java.lang.reflect.*;
|
Here is the output of the Example :
| C:\roseindia>javac Fconstructor.java C:\roseindia>java Fconstructor java.lang.String |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Getting information about Constructor
Post your Comment