Question 11

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!?
  • Question 12

    Given the code fragment:

    Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order?
  • Question 13

    Which action can be used to load a database driver by using JDBC3.0?
  • Question 14

    Given:

    What is the result?
  • Question 15

    Which three statements are benefits of encapsulation?