my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exceptions... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exceptions..." Watch "Exceptions..." New topic


Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

The above code does not compile. It compiles fine if provided with throws MalformedURLException in the defnition of test().
My question it why is it asking for throws MalformedURLException in the method test() when it is already provided with IOexception(which is a superclass of MalformedURLException).
[added CODE tags for readability, and fixed overlong line - Jim]

[This message has been edited by Jim Yingst (edited February 07, 2000).]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
It compiles fine for me using jdk 1.2.2 or jdk 1.3 beta for Windows. What compiler are you using, and on what platform?
Your logic is correct - there should be no need for a throws MalformedURLException if there is already a throws IOException. I'd assume it's a bug in your compiler.

"I'm not back." - Bill Harding, Twister
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am using JDK 1.2 on windows 95.
Thanks for u'r reply.
I agree. Here's the link:
subject: Exceptions...
It's not a secret anymore!