File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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?

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

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

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
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.
Learning the Java Language
What is an Interface?
Implementing an Interface

At Java Sun

I agree. Here's the link:
subject: Will every class inherit the object class?
It's not a secret anymore!