Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve 10 e 10. What would be the output of the program and why?? public class EqualsDemo { public static void main(String[] args) { public
solve 10
e 10. What would be the output of the program and why?? public class EqualsDemo { public static void main(String[] args) { public class First { int i; First el = new First(); First e2 = new First(); First e4 = new First(); public boolean equals (Object o) { First e = (First)o; el.i = 10; e2.i = 20; e4.i = 10; if (this.i==e.i) First e3 = 2; return true; Second e6 = new Second(); else return false; Second e7 = new Second(); } e6.i = 30; e7. i = 30; Third e8 = new Third(); } Third e9 = new Third(); e8.i = 12; 19.i = 12; public class Second { int i; System.out.println(e2.equals (83)); } System.out.println(el.equals(84)); System.out.println(e6.equals(27)); public class Third extends First { System.out.println(e8.equals(89)); } } }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started