class TestBokhylle { public static void main(String[] args) { Bokhylle bokhylle = new Bokhylle(3); System.out.println("Setter inn boeker:"); String[] titler = { "De doedes tjern", "Doppler", "Doppler", "Misery", "Gone with the Wind" }; for (int i = 0; i < titler.length; i++) { try { bokhylle.settInn(new Bok(titler[i])); } catch (DuplikatException | IkkeMerPlassException d) { System.out.println(d.getMessage()); } } /* try - catch metoden over er det samme som dette: try { bokhylle.settInn(new Bok(titler[i])); } catch (DuplikatEsception d) { System.out.println(d.getMessage()); } catch (IkkeMerPlassException ik) { System.out.println(ik.getMessage()); } */ System.out.println("\nSkriver ut boeker:"); bokhylle.skrivBoeker(); } }