Alex Rivera | Logout

Is a Java interface an abstract class?

Asked 2008-11-03T10:28:30.937
13

I'm working through some homework and a question on a previous exam paper asks to name all of the abstract classes in a given UML diagram. Fairly straightforward, I suppose. There are one abstract class and three interfaces. Do these interfaces qualify as abstract classes, in general?

Edit
Report

1 Answer

3

In Java though, theres a twist to the tale - all Interfaces in Java extend java.lang.Object! Try adding a method:

public void notify();

in an interface and see what happens..

An Interface extending a Class - Does that make the Interface a Class? Or the Class an Interface?? Uhh-huh.. Guess it was a hack that had to be done to prevent interfaces overriding the definitions in java.lang.Object that implementations of the interface had to extend anyway.

answered 2008-11-03T11:38:38.877

Your Answer