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 Will every class inherit the object class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Will every class inherit the object class?" Watch "Will every class inherit the object class?" New topic
Author

Will every class inherit the object class?

Chandra Bairi
Ranch Hand

Joined: Sep 12, 2003
Posts: 152
hello friends,
I have a doubt. Ihave read that every class extends java.lang.Object class implicitly. Does this hold for an interface also? Does a interface extend the java.lang.Object methods?


Thanks,
Shekar
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

No.
When some class implements the interface by default the class also extends java.lang.Object.


Groovy
Tom Wolve
Ranch Hand

Joined: Sep 22, 2003
Posts: 32
The simple rule is
interfaces can extend interfaces, but not classes.
classes can extend classes, but not interfaces.
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
An interface is essentially a collection of constants and abstract methods. To make use of an interface, you implement the interface in a class - that is, you declare that the class implements the interface and you write the code for each of the methods declared in the interface as part of the class definition.
Check
Learning the Java Language
What is an Interface?
Implementing an Interface

At Java Sun
HTH


doco
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Will every class inherit the object class?
 
It's not a secret anymore!