nerdexam
Oracle

1Z0-819 · Question #187

1Z0-819 Question #187: Real Exam Question with Answer & Explanation

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

Question

What change will cause the code to compile successfully? Given: public class Electronics { public Electronics(double price) { super(); } } and public class Plushy extends Electronics { public Plushy(double price) { super(price); } } and public class PriceChecker <T extends Electronics> { private T product; public PriceChecker (T product) { this.product = product; } public boolean isPriceEqual(double price) { return prod.product.getprice() == price; // line 1 } public static void main(String... args) { PriceChecker<Electronics> prod = new PriceChecker<>(new Electronics(1000.00)); PriceChecker<Plushy> prod = new PriceChecker<>(new Plushy(1.2)); // problem: variable prod already defined System.out.println(prod.isPriceEqual(b)); // problem: b not defined. } }

Options

  • AInsert PriceChecker (?) prod on line 1.
  • BInsert PriceChecker <Electronics> prod on line 1.
  • CInsert PriceChecker <Plushy> prod on line 1.
  • DInsert PriceChecker <Object> prod on line 1.

Unlock 1Z0-819 to see the answer

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