| Author |
is this a proper mock question for the exam?
|
gianni ipez
Ranch Hand
Joined: Jan 02, 2007
Posts: 65
|
|
Hello, I'm doing several mock exams. Could be the following one be a proper mock question for the exam? Which of the following declarations of robustMethod(int[] intArray) are valid in a subclass of the above class? a) public void robustMethod(int[] intArray) b) public void robustMethod(int[] intArray) throws Exception c) public void robustMethod(int[] intArray) throws Throwable d) public void robustMethod(int[] intArray) throws Error e) public void robustMethod(int[] intArray) throws RuntimeException I studied that it's not usual to throw errors, so I think this question is a bit misleading. Am I right? Is it possible to get questions like this? By the way the answer is a),d),e) Thanks, Gianni
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
Hi gianni,
Gianni:I studied that it's not usual to throw errors, so I think this question is a bit misleading. Am I right?
1.There is no need to bother about Errors or RuntimeExceptions. 1.1 Parents and Child methods can optionally declare RuntimeExceptions or Errors of their own. 2.Coming to checked-exceptions: 1.1 If parent methd has one, then 1.1.1 Child method may or may not throw that exeption 1.1.2 Child method should not declare any additional exceptions. Hope it helps you avoid ambiguity. [ April 02, 2007: Message edited by: Srinivasan thoyyeti ]
|
Thanks & Regards,<br />T.Srinivasan,<br />SCWCD 1.4(89%),SCJP 5.0(75%)<br />"That service is the noblest which is rendered for its own sake." - Mahatma Gandhi
|
 |
 |
|
|
subject: is this a proper mock question for the exam?
|
|
|