nerdexam
Oracle

1Z0-809 · Question #260

1Z0-809 Question #260: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #260. The question stem and answer options stay visible for context.

Question

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 FuelNotAvailException { //line n2 super ride (); } } and the code fragment: public static void main (String[] args) throws Exception { Vehicle v = new SolarVehicle (); v.ride(); } Which modification enables the code fragment to print Happy Journey!?

Options

  • AReplace line n1 with public void ride() throws FuelNotAvailException {
  • BReplace line n1 with protected void ride() throws Exception {
  • CReplace line n2 with void ride() throws Exception {
  • DReplace line n2 with private void ride() throws FuelNotAvailException {

Unlock 1Z0-809 to see the answer

You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-809 Practice