wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes compilation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "compilation error" Watch "compilation error" New topic
Author

compilation error

samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160


on compilation i m getting error

Note.java:16: exception FrequencyException has already been caught
}catch(FrequencyException fe){
^
1 error

can anybody help to understand
[ July 17, 2005: Message edited by: Barry Gaunt ]
Girish Bal
Ranch Hand

Joined: Jun 23, 2005
Posts: 52


Hi,

Here you are catching Exception first and then FrequencyException. That is why you are getting the compile time error. If you catch FrequencyException and then Exception, there won't be any compile error. This happens because FrequencyException extends Exception. So by catching Exception implicitly catches FrequencyException.

Am i right?
[ July 17, 2005: Message edited by: Girish Bal ]

Girish B
SCJA 1.0 (86%)
SCJP 1.4 (91%)
OCPJWCD (86%)
Ramakrishna Nalla
Ranch Hand

Joined: Apr 21, 2005
Posts: 61
Rule to remember:
All catch blocks must be ordered from most specific to most general. Simply we can say subclass exception first after that superclass exceptions we have to declare in catch block sequence...
 
 
subject: compilation error
 
Similar Threads
Will return something after error is thrown and finally executed?
Exception?
No Unreachable error ?
Exception and finally
PLease Explain Below Output