Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

Explain how confl icts can be resolved.

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago