interface Computer { void println(String text); String readLine(); } class DesktopComputer implements Computer { public void println(String text) { ... } public String readLine() { ... } } class LaptopComputer implements Computer { public void println(String text) { ... } public String readLine() { ... } } class WearableComputer implements Computer { private boolean isOn; public void println(String text) { ... } public String readLine() { ... } public void putOn() { this.isOn = true; } public void takeOff() { this.isOn = true; } } class Student { // not so good // DesktopComputer computer; Computer computer; public Student(Computer computer) { this.setComputer(computer); } } class ComputerRoom { // not so good // List computers; List computers; } new Student(new DesktopComputer()); new Student(new LaptopComputer()); new Student(new WearableComputer()); // marker interface: empty interface Serializable {} class MyClass implements Serializable { ... } void f(int[] array) { ... } f({1, 2, 3}); // wrong f(new int[]{1, 2, 3}); // OK new int[0] new int[]{} null // this is something else 1000000000 1000000