Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve 8 &9 8. What would be the output of the following code: class Test1{ private String str = Test1; class TestRemol public void showmel){
solve 8 &9
8. What would be the output of the following code: class Test1{ private String str = "Test1"; class TestRemol public void showmel){ public static void main(String args[]}{ System.out.printlo(str); Test1 t1 = new Test1(); } Test2 t2 = new Test2(); } Test3 t3 = new Test3(); class Test2 extends Test1{ private String str = "Test2"; public void showmel System.out.println(str); } } t1 = t2; t1.showmel); t1 = t3; t1.showmel); t2 = t3; t2.showmel); } class Test3 extends Test2 { private String str = "Test3"; public void showmel System.out.println(str); } } 9. What would be the output of the following program: = class Super Show { String str = "SuperClass"; public void show() { System.out.println("Super Show: } } class Extended Show extends Super Show{ String str = "SubClass"; public void show(){ System.out.println("Sub, Show: } } 08 + str); + str); public class ExtensionDeme { public static void main(String args[]){ Extended Show ext = new ExtendedShow(); Super Show sup = ext; sup.show(); ext.show(); System.out.println("supostr: System.out.println("subastr: ET + supstr); + ext.str); ET }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