What are the differences between a class and an interface in Java?

Java 8Object Oriented ProgrammingProgramming

Following are the notable differences between class and an interface.

ClassInterface
A class describes the attributes and behaviors of an object.
An interface contains behaviors that a class implements.
A class may contain abstract methods, concrete methods.
An interface contains only abstract methods.
Members of a class can be public, private, protected or default.
All the members of the interface are public by default.
raja
Published on 10-Jan-2018 16:44:31
Advertisements