Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - 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
2 months 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
Lynelle
5 days ago
I'll go with option D, just to mix things up.
upvoted 0 times
...
Gilma
7 days ago
User3: I'm not so sure, but I'll trust you guys on this one.
upvoted 0 times
...
Malcom
10 days ago
I'm leaning towards option C.
upvoted 0 times
...
Keith
17 days ago
User2: Yeah, I agree. Let's go with that.
upvoted 0 times
...
Paris
1 months ago
I'm not so sure, maybe it's option A.
upvoted 0 times
...
Carrol
1 months ago
I think option B is the correct one.
upvoted 0 times
...
Frederica
1 months ago
User1: I think option B is the way to go.
upvoted 0 times
...
...
Leontine
2 months 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
2 months 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
2 months 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
Lynelle
2 months ago
Yes, changing line n1 to 'protected void ride() throws Exception {' is the way to go.
upvoted 0 times
...
Brynn
2 months ago
I agree, option B is the correct one.
upvoted 0 times
...
...
Lisandra
2 months ago
But if we replace line n2 with void ride() throws Exception, it won't throw FuelNotAvailException.
upvoted 0 times
...
Sue
2 months ago
I disagree, I believe the answer is C.
upvoted 0 times
...
Lisandra
3 months 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