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.
Jayavardhan geepi wrote:
Is independent anonymous class possible? I mean , an anonymous class that neither extend any class nor implement any interfaces...
No. In the end there is always java.lang.Object as the root of every class hierarchy. But you can make anonymous subclasses of Object. The only thing is, unless you override equals, hashCode, toString or finalize this anonymous subclass will be pointless. Overriding clone is senseless as the class wouldn't implement Cloneable, and all other methods are final. Without overriding any of these 4 methods your anonymous subclass will behave exactly like Object itself.