This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes why does Object.class compile? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why does Object.class compile?" Watch "why does Object.class compile?" New topic

why does Object.class compile?

Gary Snider

Joined: Apr 20, 2004
Posts: 2
Can someone tell me where the .class attribute is documented? It is not in the api and not even in source code. Obviously Object.getClass() works and is documented. I've seen the .class attribute used quite frequently in production code and it irks me that it is just used and not documented. Perhaps it is in the JLS? I searched once but couldn't find it.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Here. It's not technically an attribute, though it looks like one. It's unique feature in the Java language.

"I'm not back." - Bill Harding, Twister
Gary Snider

Joined: Apr 20, 2004
Posts: 2
Thanks for the info.
I guess it was in the JLS after all.
Have you checked out Aspose?
subject: why does Object.class compile?
It's not a secret anymore!