Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

9. What is the output of the following program public class A private int i priv

ID: 3910447 • Letter: 9

Question

9. What is the output of the following program public class A private int i private int j eOverride public boolean equals (object obj) ( return super.equals (obj) public class Driver public static void main String args 1) A obj1new AO A obj2 new AO System. out printiobj 1. equals(obj2)): a. True b. False 10. What will be the output of the following code? public class Complex f private double real; private double imaginary; public String ngtostringreal + this. ímaginary + "1)"; " return "(.. + this. real + " + " + this .imaginary + "i)"; + + public Complex(int real, int imaginary)t this. real real; this.imaginary imaginary: public class Main f public static void main(String[) args) Complex c1 = new Complex (); Complex c2 new complex (5, 2); System.out.printin(c2.toString)) a. (5 + 2i) b. Complex@124FA2450 c. Compilation Error d. Runtime Error

Explanation / Answer

Answer 9: is False beause in Class A equals method we are calling super.equals which is in object. so in Object class equals method will compare the references not the content

Answer 10: answer is A. here class Complex overides the toString() and returning the custom content