public class RindMain{
public static void main (String [] args){
try{
Kuh kuh1 = new Kuh("heidi","weiblich",0,10);
Stier stier1 = new Stier("sariokuz","mannlich",1200,0);
Herde h1 = new Herde("herde1");
h1.add(kuh1);
h1.add(stier1);
System.out.println(h1.list());
System.out.println("-----------List-remove--kuh-------------");
h1.remove(kuh1);
System.out.println(h1.list());
System.out.println(h1.getSize());
} catch (MyException e){
System.out.println(e.getMessage());
}
}
}
______________________________________________________________________
public void setMilkAmount(int milkAmount) throws MyException{
if( milkAmount == 0){
throw new MyException("kuh soll milk haben");
}else{
this.milkAmount = milkAmount;
}
}
___________________________________________________________________
Burdaki hatayi anlamadim
birtürlü
___________________________________________________________________
C:\Users\murat\Desktop\eprog\tutorium>javac RindMain.java
RindMain.java:23: exception MyException is never thrown in body of corresponding
try statement
} catch (MyException e){
^
1 error
Murat