Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions...

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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).
Thanx.
[added CODE tags for readability, and fixed overlong line - Jim]

[This message has been edited by Jim Yingst (edited February 07, 2000).]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim:
I am using JDK 1.2 on windows 95.
Thanks for u'r reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic