Exam 10: Introduction to Inheritance

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

How is the keyword protected used?

(Essay)
4.9/5
(32)

When you create a class by making it inherit from another class, you are provided with data fields and ____ automatically.

(Multiple Choice)
4.9/5
(37)

class InstanceofDemo { public static void main(String[] args) { Parent object1 = new Parent(); Parent object2 = new Child(); System.out.println("object1 instanceof Parent: " + (obj1 instanceof Parent)); System.out.println("object1 instanceof Child: " + (obj1 instanceof Child)); System.out.println("object1 instanceof MyInterface: " + (obj1 instanceof MyInterface)); System.out.println("object2 instanceof Parent: " + (obj2 instanceof Parent)); System.out.println("object2 instanceof Child: " + (obj2 instanceof Child)); System.out.println("object2 instanceof MyInterface: " + (obj2 instanceof MyInterface)); } } The above code defines a parent class (named Parent), a simple interface (named MyInterface), and a child class (named Child) that inherits from the parent and implements the interface. Following program execution, what will be the output of the six println statements?

(Essay)
4.9/5
(33)

Using a class named Student, write the statement to create a yearOne object of the Student class.

(Essay)
4.8/5
(33)

The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members of the parent class are not accessible within a child class's methods.

(Multiple Choice)
4.8/5
(31)

What does polymorphism mean in Java programming?

(Essay)
4.9/5
(42)

The term ____________________ means "many forms."

(Short Answer)
4.9/5
(40)

Conventionally, arrows used in a ____ to show inheritance relationships extend from the descendant class and point to the one from which it descends.

(Multiple Choice)
4.8/5
(30)

____ is the principle that allows you to apply your knowledge of a general category to more specific objects.

(Multiple Choice)
4.9/5
(34)

A class diagram consists of a rectangle divided into three sections.

(True/False)
5.0/5
(43)

If jrStudent is an object of Student, which of the following statements will result in a value of true?

(Multiple Choice)
4.7/5
(40)

Which statement correctly declares a sedan object of the Car class?

(Multiple Choice)
4.7/5
(46)

What are virtual method calls?

(Essay)
4.8/5
(33)

The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.

(Multiple Choice)
4.7/5
(32)

Within a subclass, you can think of the keyword ____ as the opposite of super.

(Multiple Choice)
4.9/5
(34)

You would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?

(Multiple Choice)
5.0/5
(36)

In most Java classes, the keyword private precedes each data field, and the keyword ____________________ precedes each method.

(Short Answer)
4.8/5
(43)

What is the process of inlining and how is it accomplished in Java?

(Essay)
4.7/5
(40)

You can use the ____ modifier with methods when you don't want the method to be overridden.

(Multiple Choice)
4.9/5
(37)

Match each term with the correct statement below. -Makes a program run faster

(Multiple Choice)
4.9/5
(36)
Showing 41 - 60 of 70
close modal

Filters

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