interface

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";

  @Override
  public String getName() {
    return name;
  }

}

@interface

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

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface TradeSecret {
}

class SuperCalculator {

  @TradeSecret
  int calculate(int x) {
    return x + 42;
  }

}

viliam@bur.sk