public class Spill { String tittel; String developer; int aarstall; public Spill(String tittel, String developer, int aarstall) { this.tittel = tittel; this.developer = developer; this.aarstall = aarstall; } @Override public String toString() { // Kalles p? automatisk n?r man printer objektet return tittel + " av " + developer + " utgitt i " + aarstall; } @Override public boolean equals(Object o) { if (o instanceof Spill) { Spill s = (Spill) o; return tittel.equals(s.tittel); } return false; } public static void main(String[] args) { Spill halo = new Spill("Halo", "HaloDeveloper", 2001); System.out.println(halo); Spill halo2 = new Spill("Halo", "Ubisoft", 19965); System.out.println(halo.equals(halo2)); } }