ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

63 / 130

Question 63:

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!? 

Answer options:

A. Replace line n1 with public void ride() throws FuelNotAvailException {
B. Replace line n1 with protected void ride() throws Exception {
C. Replace line n2 with void ride() throws Exception {
D. Replace line n2 with private void ride() throws FuelNotAvailException {