Trusted by millions of Kenyans
Study resources on Kenyaplex

Get ready-made curriculum aligned revision materials

Exam papers, notes, holiday assignments and topical questions – all aligned to the Kenyan curriculum.

Distinguish between abstract classes and interfaces

Distinguish between abstract classes and interfaces

Answers


gregory
An abstract class can never be instantiated. Its sole purpose is to be extended (subclassed).If even a
single method is abstract, the whole class must be declared abstract. However, you can put non-abstract
methods in an abstract class.
An interface is a contractor what a class can do, without saying anything about how the class will do it.
Interfaces can be implemented by any class, from any inheritance tree. An interface can have only
abstract methods. All interface methods are implicitly public and abstract. All variables defined in an
interface must be public, static, and final i.e. interfaces can declare only constants, not instance variables.
An interface can extend one or more other interfaces. An interface cannot implement another interface or
class.
gregorymasila answered the question on January 24, 2018 at 17:39

Answer Attachments

Exams With Marking Schemes

Related Questions