aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 8898

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Will every class inherit the object class?
 
Similar Threads
Runnable.toString()?
Regarding Interfaces
Question: invoke methods in javax.xml.rpc.Call interface
Interface
Constructor in interface?