• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class.forName()

 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone explain me about the use of Class.forName() method.
Advance Thanx.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are three of the four ways to get the Class object of a type.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a program from Cay Horstmann's Core Java Volume I Chapter 5.
When you are studying Threads, or Strings or the wrapper classes, and you want a list of all the methods, run this program.
>ReflectionTest Thread
You enter a class name and Cay uses forName to get the class object. Once he has the class object, he inquires about all the members of the class.

You can modify it, if you do not want to see the fields or the private members.
[ October 13, 2003: Message edited by: Marlene Miller ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic