Questions and Answers
Which of the following is true about interfaces in Java?
They provide total abstraction
What is the purpose of using interfaces in Java?
To achieve abstraction and multiple inheritance
Which of the following is a new feature introduced in Java 8 for interfaces?
Private methods
Study Notes
- An interface in Java is a blueprint of a class with static constants and abstract methods.
- It is used to achieve abstraction and multiple inheritance in Java.
- Interfaces cannot be instantiated and represent the IS-A relationship.
- Since Java 8, interfaces can have default and static methods.
- Since Java 9, interfaces can have private methods.
- Interfaces are declared using the interface keyword and provide total abstraction.
- A class that implements an interface must implement all its methods.
- Multiple inheritance is possible through interfaces in Java.
- Java 8 introduced default and static methods in interfaces.
- Serializable, Cloneable, and Remote are examples of marker or tagged interfaces.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.