Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Java

Interfaces in Java

Define contracts with interfaces and implement them in classes.

Java Tutorial Series (44/90). Prefer one article? Read the complete Java tutorial.

Short description

Modern Java interfaces can include default/static methods. Classes may implement many interfaces.

Interface

interface Notifier {
    void send(String to);
}
class EmailNotifier implements Notifier {
    public void send(String to) { /* send email */ }
}

Leave a reply

Your email address will not be published. Required fields are marked *