Question: For each of the questions below, answer with an ArrayList declaration with the most specific type, if any, that can work. For instance, the ArrayList

 For each of the questions below, answer with an ArrayList declaration

For each of the questions below, answer with an ArrayList declaration with the most specific type, if any, that can work. For instance, the ArrayList that c ould contain Cat objects is ArrayList

1. contain Pomeranian objects

2. contain Pomeranian and Cat objects

3. contain objects of any of the above types that you can call the eat() method on.

4. contain GreatDane objects that you will only call the sleep() method on

5. contain Pomeranian and Siamese objects

6. contain Pomeranian and Siamese objects that you will call yap() and ignoreYou() , as appropriate

Consider the following classes in a Java program, with the methods defined in each: *Pet eat() sleep() o Dog extends Pet goForAWalk() yap() woof() bark() Pomeranian extends Dog GreatDane extends Dog o Cat extends Pet meow() - Siamese extends Cat ignoreYou)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!