Java SE 8 Programmer 1Z0–808 Practice Full Test 1
© examsiri.com
Question : 43 of 84
Marks:
+1,
-0
Given:
What is the result?
public class Product {
int id;
String name;
public Product(int id, String name) {
this.id = id;
this.name = name;
}
}
And given the code fragment4.Product pi = new Product(101, "Pen") ;
5.Product p2 = new Product(101, "Pen");
6.Product p3 = pi;
7.boolean ans1 = pi == p2;
8.boolean ans2 = pi.name.equals (p2.name);
9.System.out.print(ans1 +":"+ ans2);
What is the result?
Go to Question: