Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Consider the following code: public class One { //implementation not shown } public class Two extends One { //implementation not shown } public class

1. Consider the following code: public class One { //implementation not shown } public class Two extends One { //implementation not shown } public class Three extends One { //implementation not shown } Which of the following statements is true?

  1. Two inherits from One, and Three inherits from Two.
  2. Three has Two as its direct superclass.
  3. Two and Three are both subclasses of One.

A)I only

B)III only

C)I and II only

D)I and III only

E)I, II, and III

2. Consider the following partial class declarations for the Triangle and EquilateralTriangle classes: public class Triangle { private int side1, side2, side3; public Triangle (int a, int b, int c) { side1 = a; side2 = b; side3 = c; } // other code not shown } public class EquilateralTriangle extends Triangle { public EquilateralTriangle(int s) { < missing code > } // other code not shown } What code should replace < missing code >?

A)super();

B)super(s);

C)super(int s);

D)super(s, s, s);

E)super(side1, side2, side3);

3. What is the keyword that invokes the constructor of the current class's parent class?

A)class

B)extends

C)private

D)public

E)super

4.

What is a collection formed by a class and all its subclasses?

A)Class hierarchy

B)Extending classes

C)Inheritance

D)Polymorphism

E)Subclass

5.

Which of the following statements is true?

  1. A class has only one direct super class.
  2. A class can have multiple subclasses.
  3. A class can extend multiple classes.

A)I only

B)II only

C)III only

D)I and II only

E)II and III only

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

(2 of 5) "Phonic" or "phony" means: O motion O music O words sound

Answered: 1 week ago