interface (Java)

A Java type that lists operations without fixing how they are carried out, so different classes can provide their own implementations.

In more detail

Code that depends on an interface, such as List or Clock, can work with any implementation and is easier to test with a fake. A class declares that it implements an interface. A sealed interface closes the set of permitted implementations.

Example

public interface OrderRepository extends JpaRepository<OrderEntity, String> { }

Related terms

Taught in

References

Certification courses