InterfaceExtendClass
DRAFT

Misconception:

A Java interface can have a superclass. This is also shown in Javadoc, which shows all known implementing classes for an interface.

Incorrect

An interface can extend a class

Correct

Correction
Here is what's right.

Wait! Javadoc shows all known implementing classes, which means all classes Javadoc knows about who implement the given interface. A class can implement an interface. However, an interface cannot extend a class.

There is one “exception” to this rule: one could argue that interfaces somehow are subtypes of java.lang.Object (JLS Section 4.10.2 supports this view). While it is technically not exactly true that interfaces inherit the methods of Object (see JLS Section 9.2 “Interface Members”), they behave almost like that.

Language

Java

Concepts

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.