• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java reflection

 
Shenaz Assu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15452
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the API documentation of class Class. Try something like this:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic