Question: a) b) c) d) Class Wolf is a subclass of class Animal. Consider the following code: wolf wolfi - new Wolf(Scott) Animal animall -new Wolf(Isaac);

a)

a) b) c) d) Class Wolf is a subclass of class Animal.

b)

Consider the following code: wolf wolfi - new Wolf("Scott") Animal animall -newc)

Wolf("Isaac"); Animal animal2 new Animal ("Joe"); // sets instance variable "name at

d)Animal level // sets instance variable "name" at Animal level // sets

Class Wolf is a subclass of class Animal. Consider the following code: wolf wolfi - new Wolf("Scott") Animal animall -new Wolf("Isaac"); Animal animal2 new Animal ("Joe"); // sets instance variable "name at Animal level // sets instance variable "name" at Animal level // sets instance variable "name" at Animal level ArrayList(; //Note: there is a howl() method in the Wolf class for (Animal animal : zoo) f ((Wolf) animal) howl) Nobody will howl; we will get a runtime error Scott, Isaac and Joe will all howl, and there will be no runtime errors. Scott and Isaac will howl, then we will get a runtime error. Only Scott will howl; then we will get a runtime error The code will not compile, so we will never know who will howl. Which of the following is not one of the ways in which inheritance supports the principles of Object Oriented Design Principles/Encapsulation? Choose one or more of the following. a Good use of inheritance can help reduce the amount of duplicated code in a project . It allows for new features & functionality to be added to a class (by extending/subclassing it) without actually changing (or needing to know) the implementation of the class. C It allows the designer of a class to specify the behavior of that class without worrying about the implementation d.It aids in easy code maintenance and allowing developers to create a separation of the different concems (responsibilities) of classes. Based on our discussions of inheritance in class (and the slides) which of the following statements is false? a. Substitution is a form of static polymorphism because the actual objects are known at compile time. This allows us (as programmers) to substitute subtypes when some method expects super-types of a certain class hierarchy. All of these are examples of some kind of polymorphism Method overloading is a form of static polymorphism. The methods share the same name but at compilation, the compiler can determine which implementation to bind to which method calls based on the lists of parameters. Method inheritance/overriding is a form of dynamic polymorphism. Its not possible for the compiler to determine at compilation which implementation of an inherited/overridden method to bind to which method call so the JRE handles it by accessing the runtime object and checking the class hierarchy for the correct method definition If you write a class and do not include a no-arg constructor, Java will provide one for you by default that will set all of the fields to their default values, object references will be set to NULL, numeric values set to 0, and booleans set to false. However for this to work, your class's parent must have its own no-arg constructor True False

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!