What's the difference between calling MyClass.class and MyClass.getClass()

Posted by Mocha on Stack Overflow See other posts from Stack Overflow or by Mocha
Published on 2010-03-18T06:44:18Z Indexed on 2010/03/18 6:51 UTC
Read the original article Hit count: 123

Filed under:
|

MyClass.class and MyClass.getClass() both seem to return a java.lang.Class. Is there a subtle distinction or can they be used interchangeably? Also, is MyClass.class a public property of the superclass Class class? (I know this exists but can't seem to find any mention of it in the javadocs)

© Stack Overflow or respective owner

Related posts about java

Related posts about reflection