Question 13
Consider the code given below that checks whether two vehicles are the same. Method equals is overridden to compare two Vehicle objects as follows. If two vehicles have the same registration number, then they are the same. Based on the given information, answer the question that follows.
class Vehicle{ private String regno;
//Constructor to initialize instance variables
public String toString() { return regno; } public boolean equals(Object obj) { // CODE BLOCK }}public class Test { public static void main(String[] args) { Vehicle v1 = new Vehicle("RC12345"); Vehicle v2 = new Vehicle("RC99999"); Vehicle v3 = new Vehicle("RC99999"); if(v1.equals(v3)) System.out.println(v1+", "+v3+" are same"); if(v2.equals(v3)) System.out.println(v2+", "+v3+" are same"); }}Choose the correct option(s) to fill in place of CODE BLOCK so that the output is:
RC99999, RC99999 are same