Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

forName() and getInterfaces()  RSS feed

 
Ronan Leonard
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to use the forName() method to verify if a string is an actual classname or not. Do I have to explicitly write the method? How is it done? Same question for getInterfaces() method.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just pass the name of the class to the forName method and it will throw a ClassNotFoundException if the class does not exist.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the forName() and getInterfaces() doc on java.lang.Class.



[ November 20, 2007: Message edited by: Bill Shirley ]
[ November 20, 2007: Message edited by: Bill Shirley ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!