Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java related questions 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Which of the following statements properly describes how to declare a

java related questions

1.

image text in transcribed

2.

image text in transcribed

3.

image text in transcribed

4.

image text in transcribed

5.

image text in transcribed

6.

image text in transcribed

7.

image text in transcribed

8.

image text in transcribed

9.

image text in transcribed

10.

image text in transcribed

11.

image text in transcribed

Which of the following statements properly describes how to declare a Java interface? Select one: Interfaces must be derived from related classes. Interfaces are declared using the interface keyword. O Interfaces must be declared and saved in an interface package. O Interfaces are declared just like classes. Which of the following are consequences of extending a Java interface? Select all appropriate answers: Polymorphism no longer works; only the child type remains. Any class that implements the child interface must provide implementations of all methods declared in both the parent and the child interfaces (or be marked abstract). The child interface inherits all of the methods declared in the parent interface. Any class that implements the child interface must also declare that it implements the parent interface. Which of the following must you do when implementing a Java interface? Select one: o Overload at least one of the methods defined in the interface. O Subclass the interface to inherit its method implementations. O Provide implementations for all methods declared in the interface or mark the class as abstract. Use the implementing key word. Which of the following statements are true about the relationship between interfaces and polymorphism? Select all appropriate answers: O A child interface may be treated as if it is an instance of its parent interface. O A non-abstract class that implements an interface may be treated as an instance of the interface type. O A non-abstract class that implements an interface must provide implementations for all the methods declared in the interface. O A non-abstract class that implements more than one interface may only be treated as an instance of the first interface listed in the class definition. Which of the following statements are true of composition? Select all appropriate answers: Composition refers the fact that objects can be made up of other objects. Composition refers to the process of writing well-designed classes. Declaring, instantiating, and using other classes inside a method are good examples of composition. The terms composition and aggregation can be used interchangeably. Which of the following are benefits of inheritance? Select all appropriate answers: Inheritance allows for more maintainable code because it cuts down on repeated code. Inheritance allows objects to behave as any type depending on the program's need in any given situation. Inheritance allows child classes to reuse code written in parent classes. Inheritance allows for easy copying and pasting of code in related classes. Which of the following statements use the proper terminology with respect to inheritance? Select all appropriate answers: Superclass and base class are equivalent terms. A base class is also known as a parent class. A parent class is derived from a base class. A child class extends a parent class. Which of the following statements is true of method overriding? Select all appropriate answers: You can override a method in a parent class as many times as you want in the child class. You must change the signature of a method you wish to override. You must change the name of a method in order to override it. Child classes override methods of parent classes. Which of the following statements properly describe polymorphism? Select all appropriate answers: An object can be treated as any type as long as you have the proper reference. Derived types behave the same as their base types. Subclasses can be treated as if they are superclasses. Casting operators are what make polymorphism possible. If you see the following class definition, which of the following statements of the following are true? public class Husky extends Dog implements Huggable, Trainable{ Select all appropriate answers: Huggable is an interface. Dog is the parent class of Husky. Husky must implement all the methods in Trainable or Huggable, but not both. Trainable is a parent interface of Huggable. Husky must override all the methods in Dog. Method ____ is when two methods share the same name but different parameter lists. Select one: overriding overreaching overloading doubling O duplication

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions