PDF File

Latest Oracle 1Z0-809 Practice Questions BY Lynn

Question 1

Given:

public interface Moveable {

public default void walk (Integer distance) {System.out.println(''Walking'');)

public void run(Integer distance);

}

Which statement is true?

  • A. Moveable can be used as below:Moveable animal = n - > System.out.println(''Running'' + n);animal.run(100);animal.walk(20);
  • B. Moveable can be used as below:Moveable animal = n - > n + 10;animal.run(100);animal.walk(20);
  • C. Moveable can be used as below:Moveable animal = (Integer n) - > System.out.println(n);animal.run(100);Moveable.walk(20);
  • D. Movable cannot be used in a lambda expression.
Question 2

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

  • 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 {