Question 8
Consider the code given below that checks whether two phones are the same. Method equals is overridden to compare two Phone objects as follows.
If two phones have the same brand and imeiNumber, then they are the same.
class Phone { private String brand; private int imeiNumber;
// Constructor to initialize instance variables
public boolean equals(Object obj) { //CODE BLOCK }}public class Test { public static void main(String[] args) { Phone p1 = new Phone("Samsung", 123456); Phone p2 = new Phone("Samsung", 123456); if (p1.equals(p2)) System.out.println("p1 and p2 are same"); else System.out.println("p1 and p2 are different"); }}Choose the correct option(s) to fill in place of CODE BLOCK so that the output is:
p1 and p2 are same