Question: 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

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!