File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java reflection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java reflection" Watch "Java reflection" New topic

Java reflection

Shenaz Assu
Ranch Hand

Joined: Sep 21, 2007
Posts: 32
Hi All,

I am new to java reflection. I have a Class c variable. I need to check if its an instance of Number.class. If so, i'll need to invoke anyone of the constructors of the subclasses of Number (Long, Double, etc..) depending upon the variable c. Is it possible using the reflection.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15100

Have a look at the API documentation of class Class. Try something like this:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Java reflection
It's not a secret anymore!