Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following simplified UML class diagram ( we omit visibility of variables and return types of methods ) : Animal super class, Cat and
Consider the following simplified UML class diagram we omit visibility of variables and return types of methods:
Animal super class, Cat and Dog child classes of Animal, Cat and Dog implements Vocalisable
Consider the method private void addCats:
Creates instances of Animal, Cat and Dog
and an ArrayList.
private void addCats
Animal myAnimal new Animal;
Cat myCat new CatKitty "Persian cat";
Dog myDog new DogWoofer "Golden Retriever";
ArrayList cats new ArrayList;
code selected below will go here
Based on the given simplified UML class diagram and code snippet above, select all code statements that can be added to addCats without compiletime or runtime errors:
Question Select one or more:
cats.addmyDog;
cats.addCat myAnimal;
cats.addCat myDog;
cats.addmyAnimal;
cats.addmyCat;
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