A more generic way, how to retrieve the name of the class (that is used in the program) that reflects the package name by using the getName() method. Here is an example that provides the proper way to use the getName() method.
Here we create an object of class Fclass and assign the reference of the class java.util.Integer.class to it. Now retrieve the class name (that is included in the program) by using the getName() method.
Here is the code of the Example :
Here is the output of the Example :
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Ask Questions? Discuss: Retrieving the class name through Reflection API
Post your Comment