Exam 10: Inheritance

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When declaring class data members, it is best to declare them as:

(Multiple Choice)
4.8/5
(45)

Look at the following code. Which line will cause a compiler error? Line 1 public class ClassA Line 2 { Line 3 public ClassA() {} Line 4 public final int method1(int a){} Line 5 public double method2(int b){} Line 6 } Line 7 public ClassB extends ClassA Line 8 { Line 9 public ClassB(){} Line 10 public int method1(int b){} Line 11 public double method2(double c){} Line 12 }

(Multiple Choice)
4.9/5
(33)

When an interface variable references an object, you can use the interface variable to call any and all of the methods in the class implementing the interface.

(True/False)
4.7/5
(26)

Look at the following code. Line 1 public class ClassA Line 2 { Line 3 public ClassA() {} Line 4 public void method1(){} Line 5 } Line 6 public class ClassB extends ClassA Line 7 { Line 8 public ClassB(){} Line 9 public void method1(){} Line 10 } Line 11 public class ClassC extends ClassB Line 12 { Line 13 public ClassC(){} Line 14 public void method1(){} Line 15 } Which method1 will be executed as a result of the following statements? ClassA item1 = new ClassC(); Item1.method1();

(Multiple Choice)
4.9/5
(36)

If a superclass does not have a default constructor or a no-arg constructor:

(Multiple Choice)
4.8/5
(33)

If a subclass constructor does not explicitly call a superclass constructor:

(Multiple Choice)
4.8/5
(41)

All methods in an abstract class must also be declared abstract.

(True/False)
4.8/5
(36)

If two methods have the same name but different signatures, they are:

(Multiple Choice)
4.8/5
(33)

When a subclass extends a superclass, the public members of the superclass become public members of the subclass.

(True/False)
4.8/5
(41)

What is required for an interface method that has a body?

(Multiple Choice)
4.8/5
(40)
Showing 61 - 70 of 70
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)