Keyword "interface" is used in Java to define an interface. An interface is a set of method headers.

A class that implements the interface must implement all its methods.

public interface Named {

  String getName();


class Kitten implements Named {

  private String name = "Kitty";

  public String getName() {
    return name;



The keyword "@interface" is used to define an annotation.

public @interface TradeSecret {

class SuperCalculator {

  int calculate(int x) {
    return x + 42;