Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

bug in rule roundup #231  RSS feed

 
evansac
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

overloaded should be overidden
 
paul wheaton
Trailboss
Posts: 22531
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's take a look:
Here is the current question:
(#231)TRUE or FALSE: overloaded methods must not throw new checked exceptions not thrown by the original method.

Here is the current Answer:
FALSE This would be true for overriding methods, but overloaded methods are free to throw new checked exceptions.

I think the answer is correct as is. Anybody else wanna chip in on this one?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats right.
In the case of overridden methods, the following rules apply:
** overriding methods that throw exceptions, may throw the same/a subclass or a runtime excption that are thrown by the overridden methods
and for overloaded methods they are:
** overloading methods may throw any exception that are not available in the overloaded method
[This message has been edited by Lionel (edited May 30, 2000).]
 
evansac
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question as worded makes no sense to me:
TRUE or FALSE: overloaded methods must not throw new checked exceptions not thrown by the original method.
The term "original method" has no meaning in the context of
overloaded methods, but it does in the case of an overriden
method.
Are you suggesting that the student is supposed to spot that
the question makes no sense and so answer false?
 
paul wheaton
Trailboss
Posts: 22531
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup!
The statement is false, is it not?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!