Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-809 Topic 1 Question 63 Discussion

Actual exam question for Oracle's 1Z0-809 exam
Question #: 63
Topic #: 1
[All 1Z0-809 Questions]

Given:

class FuelNotAvailException extends Exception { }

class Vehicle {

void ride() throws FuelNotAvailException {//line n1

System.out.println(''Happy Journey!'');

}

}

class SolarVehicle extends Vehicle {

public void ride () throws Exception {//line n2

super ride ();

}

}

and the code fragment:

public static void main (String[] args) throws FuelNotAvailException, Exception {

Vehicle v = new SolarVehicle ();

v.ride();

}

Which modification enables the code fragment to print Happy Journey!?

Show Suggested Answer Hide Answer
Suggested Answer: D


Contribute your Thoughts:

Delisa
5 days ago
Haha, this question is a real head-scratcher! I'm gonna go with option B just for the heck of it. Maybe the exam folks are trying to trip us up with this one.
upvoted 0 times
...
Leontine
8 days ago
Ah, the old exception handling conundrum. I reckon option B is the way to go. Gotta love those pesky checked exceptions, am I right?
upvoted 0 times
...
Carylon
9 days ago
I'm not sure about this one. The question seems a bit tricky, but I'm leaning towards option C. Replacing line n2 with 'void ride() throws Exception {' might do the trick.
upvoted 0 times
...
Clemencia
13 days ago
Hmm, I think the correct answer is B. Replacing line n1 with 'protected void ride() throws Exception {' would allow the code to print 'Happy Journey!' since the overriding method in the subclass must have the same or a broader exception declaration as the superclass method.
upvoted 0 times
...
Lisandra
14 days ago
But if we replace line n2 with void ride() throws Exception, it won't throw FuelNotAvailException.
upvoted 0 times
...
Sue
16 days ago
I disagree, I believe the answer is C.
upvoted 0 times
...
Lisandra
25 days ago
I think the answer is A.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77