Language elements: Interfaces class Horse { ... } class Unicorn extends Horse { ... } Element of pure design. interface Calculator { int add(int n, int m); } So we put together this example: interface Calculator { int add(int n, int m); } class One implements Calculator { public int add(int n, int m) { return n + m; } public static void main(String[] args) { Calculator a = new One(); System.out.println(a.add(5, 3)); } } class Two implements Calculator { public int add(int n, int m) { if (n == 0) return m; else return this.add(n-1, m+1); } public static void main(String[] args) { Calculator a = new Two(); System.out.println(a.add(5, 3)); } } Then we have this example: import java.util.*; class Circle extends Shape { String area() { return "As a circle I'd multiply pi with the square of ..."; } } class Rectangle extends Shape { String area() { return "As a rectangle I'd multiply the length of ..."; } } class Triangle extends Shape { String area() { return "As a triangle I'd apply Heron's formula and ..."; } } class Shape { String area() { return "As a shape it would wrong for me to say I can do this..."; } } class One { public static void main(String[] args) { int[] nums; nums = new int[3]; nums[0] = -1; nums[1] = 6; nums[nums.length - 1] = 12; System.out.println (Arrays.toString(nums)); Circle a = new Circle(); Rectangle b = new Rectangle(); Triangle c = new Triangle(); Shape[] stuff; stuff = new Shape[3]; stuff[0] = a; stuff[1] = b; stuff[2] = c; for (int i = 0; i < stuff.length; i++) System.out.println(stuff[i].area()); } } Which could be modified as follows: import java.util.*; class Circle implements Shape { public String area() { return "As a circle I'd multiply pi with the square of ..."; } } class Rectangle implements Shape { public String area() { return "As a rectangle I'd multiply the length of ..."; } } class Triangle implements Shape { public String area() { return "As a triangle I'd apply Heron's formula and ..."; } } interface Shape { String area(); } class One { public static void main(String[] args) { int[] nums; nums = new int[3]; nums[0] = -1; nums[1] = 6; nums[nums.length - 1] = 12; System.out.println (Arrays.toString(nums)); Circle a = new Circle(); Rectangle b = new Rectangle(); Triangle c = new Triangle(); Shape[] stuff; stuff = new Shape[3]; stuff[0] = a; stuff[1] = b; stuff[2] = c; for (int i = 0; i < stuff.length; i++) System.out.println(stuff[i].area()); } } We could also use abstract classes for a compromise between these two alternatives. Next time: ArrayLists, GUIs and Tomcat.