1234567891011121314151617181920212223242526272829303132333435363738394041 |
- class Oblig1 {
- public static void main(String[] args) throws Exception {
- // 1
- Bol<Mus> musebol = new Bol<>();
- Bol<Rotte> rottebol = new Bol<>();
-
- // 2
- Katt katt = new Katt("Tom");
-
- // 3
- katt.jakt(musebol, rottebol);
-
- //4
- Rotte rotte = new Rotte("Remy");
-
- // 5
- rottebol.settInn(rotte);
-
- // 6
- katt.jakt(musebol, rottebol);
-
- // 7
- Mus mus = new Mus("Jerry");
-
- // 8
- musebol.settInn(mus);
-
- // 9
- Mus mus2 = new Mus("Cray");
-
- // 10
- try {
- musebol.settInn(mus2);
- } catch (Exception ex) {
- System.out.println(ex.toString());
- }
-
- // 11
- katt.jakt(musebol, rottebol);
- }
- }
|