Java ClassesLesson 39Free preview
Java Interface
This lesson is part of Java · All levels
Summary
The interface defines a contract as a method that must be implemented by the user class. One class can implement multiple interfaces at once, thus overcoming the limitations of single inheritance in Java. Since Java 8, the interface can also have a default method already contained.
Key points
- Interface declared with keyword interface, implemented with implementations
- Traditionally, the method interface has only a signature without a body.
- A class can implement more than one interface
- Interfaces are often used to define the capabilities of many different types.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.