The moose likes Ranch Office and the fly likes Question #226 -- wrong answer Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » This Site » Ranch Office
Reply Bookmark "Question #226 -- wrong answer" Watch "Question #226 -- wrong answer" New topic
Author

Question #226 -- wrong answer

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The question reads:
"(#226)All exceptions inherit from:"
The choices were exception error and throwable. Technically all exceptions extend java.lang.exception, as well as java.lang.throwable, so both of those choices should be correct. The question only excepts an answer of java.lang.throwable
ray
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 17880

(#226)All exceptions inherit from:
java.lang.Throwable
java.lang.Error
java.lang.Exception
.........
You're right.
What might be a better way to ask this question?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18641
Consider:
<code><pre> throw new Exception("A plain old Exception");</pre></code>
Does this object inherit from Exception? I'd say no, it is an exception. It's an exception which does not inherit from Exception. Maybe others interpret "inherit" a bit differently though.
If you want to be safe, just drop the Exception option. (I was going to suggest "extend" instead of "inherit", but there are ambiguities there too with direct extension vs. indirect extension.) You can put in java.lang.RuntimeException and java.lang.BaseExpression instead. Or Java.lang.Tossable.


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

Joined: Jun 08, 2000
Posts: 64
Perhaps you could just invert the question, placing what was the answer in the top, and the question as the answer. Like this:
Which class inherits from java.lang.Throwable?
java.lang.Exception
java.lang.RuntimeException
java.lang.Error
all of the above
none of the above
Me, I would choose all of the above. Anyway, just a suggestion

[This message has been edited by Paul Caudle (edited June 15, 2000).]
Deepoo
Greenhorn

Joined: Jun 12, 2000
Posts: 10
Originally posted by Paul Wheaton:
(#226)All exceptions inherit from:
java.lang.Throwable
java.lang.Error
java.lang.Exception
.........
You're right.
What might be a better way to ask this question?

Paul,
A better way to frame this question would be to ask the person to pick the class that is NOT part of the inheritance hierarchy of an exception class.
-----------------------------------------------------------------
(#226) All exceptions inherit/extend from the classes below, except
1. java.lang.Throwable
2. java.lang.Error
3. java.lang.Exception
-----------------------------------------------------------------
Deepak

[This message has been edited by Deepoo (edited June 15, 2000).]
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 17880

In reading all this I had an idea. How about
What is the root class for the type of object that can be used in a catch statement?
Exception
RuntimeException
Error
Throwable
Catchable
Whaddya think?
Paul Caudle
Ranch Hand

Joined: Jun 08, 2000
Posts: 64
Sounds good to me. I like it. I say go for it
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6911
Except that "Object" is the root class of everything, and is not on the list!


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
How about making the question a little broader.
"What class to all Errors and Exceptions inherit from?"
and have the same three options.
Errors do not inherit from java.lang.Exception, but do inherit from Throwable.
What do you think?


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 17880

Angela, I think that makes the question easier! I want these questions to be tough! I also want them to be accurate and unambiguous.
Frank, I think you are right, I should add Object to the list too. The key being that you cannot catch any Object.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 17880

I made the change, but I'm worried that it all might be too big for the applet now.
Can somebody go through the applet and try to find this question again and see if it is okay?
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
I don't know if you intended thiis but all I see is:
What is the root class for the object used in the catch statement
java.lang.Throwable;
java.lang Error;
Did you intend to give more options?
 
 
subject: Question #226 -- wrong answer
 
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture