CISC 190 Chapter 10

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Protected class members are denoted in a UML diagram with the symbol

#

When an "is a" relationship exists between objects, it means that the specialized object has:

all the characteristics of the general object, plus additional characteristics

If ClassA extends ClassB, then

public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA

What key word can you use to call a superclass constructor explicitly

super

If a class contains an abstract method:

the method will have only a header, but not a body, and end with a semicolon

When a subclass overloads a superclass method:

Both methods may be called with a subclass object

Given the following code which of the following is TRUE? public class ClassB implements ClassA{}

ClassB must override each method in ClassA.

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 method will be executed as a result of the following statements? ClassA item1=new ClassC(); item1.method1();

Line 14

Look at the following code. Which line in ClassA has an error? Line 1 public interface MyInterface Line 2 { LIne 3 int FIELDA=55; Line 4 public int method(double); LIne 5 } Line 6 public class ClassA implements MyInterface Line 7 { Line 8 FIELDA=60; Line 9 public int method(double){} Line 10}

Line 8

Replacing inadequate superclass methods with more suitable subclass methods is known as what?

Method overriding

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

The method header must begin with the key word default.

In an inheritance relationship:

The superclass constructor always executes before the subclass constructor

If ClassC extends ClassB, which extends ClassA, this would be an example of:

a chain of inheritance

Protected members are:

both not quite private and not quite public

Like a family tree, a ________ shows the inheritance relationship between classes.

class hierarchy

An anonymous inner class must:

either implement an interface or extend another class

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

private members

Which of the following statements correctly specifies three interfaces?

public class ClassA implements Interface1, Interface2, Interface3

If a class contains an abstract method

All of these Answers: you cannot create an instance of the class the method will have only a header, but not a body, and end with a semicolon the method must be overridden in subclasses

This is a special type of expression used to create an object that implements a functional interface.

lambda


संबंधित स्टडी सेट्स

Mastering Biology Ch. 42: Circulation and Gas Exchange

View Set

Abeka 5th Grade Science Test 3 Study Guide

View Set

Advanced Bio Chapter 21 (pg. 455-463)

View Set

(Feist) Chapter 2: Conducting Research in Psychology

View Set

Implementing and Troubleshooting Wireless Networks (Lesson 13)

View Set

Health Assessment Chapter 13 PrepU

View Set