Asked by Mikaela Forcum on Jul 21, 2024

verifed

Verified

A Java interface is an example of:

A) encapsulation
B) abstraction
C) polymorphism
D) all of the above

Java Interface

A reference type in Java that can contain only method signatures and static fields, used to define a contract for classes to implement.

Encapsulation

Encapsulation is an object-oriented programming concept involving the bundling of data with the methods that operate on that data, restricting direct access to some of the object's components.

Abstraction

A fundamental concept in object-oriented programming that hides the complexity of a system by displaying only essential features to the user, allowing focus on what an object does instead of how it does it.

  • Understand the advantages and applications of encapsulation, abstraction, and polymorphism via interfaces.
verifed

Verified Answer

NA
Nguy?n Anh ?ôngJul 23, 2024
Final Answer :
B
Explanation :
A Java interface is an example of abstraction as it defines a set of actions or behaviors without specifying how those actions will be implemented in the implementing class. Encapsulation and polymorphism are also fundamental concepts in Java programming but are not directly related to interfaces.