nerdexam
Oracle

1Z0-808 · Question #36

class Product { double price; } public class Test { public static void updatePrice (Product product, double price) { product.price = price; price = 2; product.price = product.price + price; } public…

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

Java Class Design

Question

class Product { double price; } public class Test { public static void updatePrice (Product product, double price) { product.price = price; price = 2; product.price = product.price + price; } public static void main(String[] args) { Product prt = new Product(); prt.price = 200; double newPrice = 100; Test t = new Test(); t.updatePrice (prt, newPrice); System.out.println (prt.price + ":" + newPrice); } } What is the result?

Options

  • A200.0 : 100.0
  • B400.0 : 200.0
  • C200.0 : 100.0
  • DCompilation fails.

Unlock 1Z0-808 to see the answer

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

Topics

#pass by value#object references#primitive types#method parameters
Full 1Z0-808 Practice