Groups
Groups
Sign in
Groups
Groups
javacoder_ss11
Conversations
About
Send feedback
Help
exception
2 views
Skip to first unread message
Murat Kozan
unread,
Jun 6, 2011, 9:13:07 AM
6/6/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javacod...@googlegroups.com
arkadaslar benim bir method var
public void setMilkAmount(int milkAmount) throws Exception{
if( milkAmount == 0){
throw new Exception ("kuh soll milk haben");
}else{
this.milkAmount = milkAmount;
}
}
ve main klassede methodu cagirip ekrana hata mesaji "kuh soll milk haben" cikartmak isdiyorumm ve söyle yaziyorum;
kuh1.setMilkAmount(0);
System.out.println(kuh1.getMilkAmount());
ve söyle bir hata veriyor;
C:\Users\murat\Desktop\eprog\tutorium>javac RindMain.java
RindMain.java:8: unreported exception java.lang.Exception; must be caught or dec
lared to be thrown
kuh1.setMilkAmount(0);
^
Murat
Reply all
Reply to author
Forward
0 new messages