nerdexam
Oracle

1Z0-809 · Question #63

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

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

Question

Given the following code:
public enum USCurrency {
 PENNY (1),
 NICKLE (5),
 DIME (10),
 QUARTER (25);

 int value;

 private USCurrency (int value) {
 this.value = value;
 }
}

public class Coin {
 public static void main (String[] args) {
 USCurrency usCoin = new USCurrency.DIME;
 System.out.println(usCoin.getValue());
 }

 public int getValue() {
 return value;
 }
}
Which two modifications enable the given code to compile?

Options

  • ANest the USCurrency enumeration declaration within the Coin class.
  • BMake the USCurrency enumeration constructor private.
  • CRemove the new keyword from the instantiation of USCoin.
  • DMake the getter method of value as a static method.
  • EAdd the final keyword in the declaration of value.

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