A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Que from JQPlus!!
Joined: Jul 07, 2003
Jan 17, 2004 14:18:00
Consider the following hierarchy of Exception classes :
Which of the following statements are correct for a method that can throw ArrayIndexOutOfBounds as well as StringIndexOutOfBounds Exceptions but does not have try catch blocks to catch the same?
Select 3 correct options.
1) The method calling this method will either have to catch these 2
exceptions or declare them in it's throws clause.
2) It's ok if it declares just 'throws
3) It must declare 'throws
4) It's ok if it declares just 'throws
5) It does not need to declare any throws clause.
The given answers were: 2, 4 & 5.
I selected 1,2 & 4.
clarify the correct answers!!!
Joined: Dec 27, 2003
Jan 17, 2004 19:49:00
all inherit from
(indirectly in the case of
). Anything inheriting from
is considered a non-checked exception, and
does not have to be declared to be thrown by a method. However, while
you don't *have* to declare it, you *may* declare it. So in this case,
you could declare either one by itself, neither, or both.
A+, Network+, SCJP, SCWCD<br />preparing for SCBCD, SCEA, CompTIA I-Net+
I agree. Here's the link:
- it saves me about five hours per week
subject: Que from JQPlus!!
Queries from bills mock exam
JQPlus Question ID :954959230738
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013