Answer :
Answer:
a) public class Bear extends Animal{ ... }
public class Zoo { private Animal[] myAnimals;
... }
Explanation:
The question is an illustration of inheritance in Java programming language.
The syntax to follow is:
class subclass extends superclass {...}
From the question:
Bear [tex]\to[/tex] subclass
Animal [tex]\to[/tex] superclass
So, the following declaration will be used:
class Bear extends Animal{ ... }
Also from the question, the zoo object represents collection of many animals.
So, its declaration will follow:
class class-name{ ..... }
i.e.
class zoo{ .... }
The ... can then be replaced with declaration of each animal or an array to represent the declarations..
Hence, (e) is correct
The most appropriate set of declarations is; Option E
What is the best programming pattern?
From the parameters given in the question, we can say that;
Bear is a subclass
Animal is a superclass
This means that the declaration that will be used is;
public class Bear extends Animal{ ... }
Now, we also see that Zoo are declared to represent animal, bear and zoo objects. Thus, the declaration would be;
public class Zoo
{
private Animal[] myAnimals;
...
}
Looking at the given options, only option E is correct.
Read more about Java Programming at; https://brainly.com/question/18554491