Every Java class X can get its class name from X.class.
When I check it in the JDK documents, there isn't a member named class in Object.
Where does the class member come from?
Every Java class X can get its class name from X.class.
When I check it in the JDK documents, there isn't a member named class in Object.
Where does the class member come from?
Foo.class is not a member of Foo, even though the syntax looks like it.
Foo.class is actually a Class Literal expression.
That means that it's just a special syntax in the language that's used to refer to the class of a given type.
If you used reflection to inspect Foo you wouldn't see a static field class.