This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes exception (source: K&B) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "exception (source: K&B)" Watch "exception (source: K&B)" New topic
Author

exception (source: K&B)

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
from K&B


how can we possibly solve this error?
I tried different approach and not quite understood how...


boolean b = true;<br />System.out.println ("I believe in Java.<br />Java will make my dream come " + b);
Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Hi Adam,

Animal.eat() declares a checked exception, so any client code must either catch the exception or declare the checked exception as well. Thus you have two options for fixing the compilation error:

Handling the checked exception:

Declaring the checked exception:


SCJP 5.0
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: exception (source: K&B)
 
Similar Threads
OverLoading
SCJP book - Overriding/Overloading objective
Overriding doubt in K&B
Overriding
Exception in Overriding