nerdexam
Oracle

1Z0-850 · Question #47

1Z0-850 Question #47: Real Exam Question with Answer & Explanation

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

Question

Given:
  1. public enum Color { RED, YELLOW, GREEN }
  2. enum Fruit {
  3. Banana(Color.RED),
  4. Apple(Color.YELLOW),
  5. Kiwi(Color.GREEN);
  6. private Color color;
  7. Fruit(Color color) {
  8. this.color = color;
  9. }
  10. }
  11. class Test {
  12. public void method() {
  13. // insert code here
  14. }
  15. } Which two, inserted independently at line 13, allow the code to compile? (Choose two.)

Options

  • AColor red = Color.values()[0];
  • BFruit f = Banana;
  • CFruit[] fruits = Fruit.values();
  • DFruit f = new Fruit(Color.RED);
  • EFruit f = Fruit.Banana; switch (f) {}

Unlock 1Z0-850 to see the answer

You've previewed enough free 1Z0-850 questions. Unlock 1Z0-850 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-850 Practice