Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following two animal classes: public class Cat { public void c1() { System.out.println(cat 1); } public void c2() { System.out.println(cat 2); } public
Consider the following two animal classes:
public class Cat { public void c1() { System.out.println("cat 1"); } public void c2() { System.out.println("cat 2"); } public String toString() { return "meow"; } } public class Tiger extends Cat { public void c1() { System.out.println("tiger 1"); } }
Given the following declared variables, what is the output from the following statements?
Cat myCat = new Cat(); Tiger myTiger = new Tiger();
System.out.println(myCat); myCat.c1(); myCat.c2(); System.out.println(myTiger); myTiger.c1(); myTiger.c2();
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