In the main method of a class (or any static method), how can I find out what class I am in?

John Mitchell

To get the Class object associated with that class, you have to reference the name of the class directly and use the .class keyword. I.e., if your class is named Foo use Foo.class to get the Class object for Foo.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact