New Year Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Java SE 1z0-809 Reddit Questions

Page: 2 / 7
Total 196 questions

Java SE 8 Programmer II Questions and Answers

Question 5

Given:

and the command:

java Product 0

What is the result?

Options:

A.

An AssertionError is thrown.

B.

A compilation error occurs at line n1.

C.

New Price: 0.0

D.

A NumberFormatException is thrown at run time.

Question 6

Given:

and the code fragment:

What is the result?

Options:

A.

0.0

B.

1500.0

C.

A compilation error occurs.

D.

2000.0

Question 7

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

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 {

Question 8

Given the Greetings.properties file, containing:

and given:

What is the result?

Options:

A.

Compilation fails.

B.

GOODBY_MSG

C.

Hello, everyone!

D.

Goodbye everyone!

E.

HELLO_MSG

Page: 2 / 7
Total 196 questions