nerdexam
Oracle

1Z0-808 · Question #34

1Z0-808 Question #34: Real Exam Question with Answer & Explanation

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

Java Basics

Question

public class Product { int id; String name; public Product (int id, String name) { this.id = id; this.name = name; } } And given the code fragment: 4. Product p1 = new Product (101, "Pen"); 5. Product p2 = new Product (101, "Pen"); 6. Product p3 = p1; 7. boolean ans1 = p1 == p2; 8. boolean ans2 = p1.name.equals (p2.name); 9. System.out.print (ans1 + ":" + ans2); What is the result?

Options

  • Atrue:true
  • Btrue:false
  • Cfalse:true
  • Dfalse:false

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

#Reference Equality#equals() method#== operator#Object Identity
Full 1Z0-808 Practice