Chapter 10 Inheritance (Review)

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

_____ class can have abstract and non-abstract methods. From Java 8, it can have default and static methods also.

Abstract

_____ class can have final, non-final, static and non-static variables. ______ has only static and final variables.

Abstract, Interface

_____ class can provide the implementation of interface. Interface can't provide the ______ of abstract class.

Abstract, implementation

In a subclass constructor, a call to the superclass constructor must __________.

appear as the very first statement

Variables declared in a Java interface are by default _____. An _____ class may contain non-final variables.

final, abstract

An anonymous inner class must__________.

implement an interface or extend a super class

You can use alambda expression to instantiate anobject that__________.

implements a functional interface

A Java interface can be implemented using keyword "_______" and abstract class can be extended using keyword "_____".

implements, extends

You cannot create an______ of an abstract class.

instance

This operator can be used to determine whether a reference variable references an object of a particular class.

instanceof

An interface can extend another Java _____ _____, an abstract class can extend another Java class and implement multiple Java interfaces.

interface only

The subclass must call a public or protected superclass______ in order to access the superclass's private members.

method

You use the __________ operator to define an anonymous inner class.

new

A functional interface is an interface with__________.

only one abstract method.

A method in a subclass having the same name as a method in the superclass but a different signature is an example of __________.

overloading

Abstract methods must be__________.

overridden

An abstract method cannot have a body. It must be _______ in a subclass.

overridden

An abstract method must be ________ in a subclass.

overridden

A method in a subclass that has the same signature as a method in the super class is an example of ___

overriding

When you do not give a class member an access specifier, it is granted _______ access by default. This means that any method in the same package may access the member.

package

A sub class does not have access to the sesuper class members.

private

These superclass members are accessible to subclasses and classes in the same package.

protected

When a class implements an interface, it must__________.

provide all of the nondefault methods that are listed in the interface, with the exact signatures and return types specified

When a class implements an interface, all of the methods specified by the interface must be _______ in the class.

provided

Members of a Java interface are ____ by default

public

An abstract method header does not have a body, and it must be terminated with a _______.

semicolon

Overloading is not the same as overriding. When a superclass has an abstract method, the subclass must have a method with the same _______ as the abstract method.

signature

When a class implements an interface, the class must have methods with the same ______ and ____ ____ as the methods specified in the interface.

signature, return type

In an inheritance relationship , this is the specialized class.

subclass

Private superclass members cannot be directly accessed by a method in a ______.

subclass

This key word refers to an object's superclass.

super

When a subclass method calls an overridden superclass method, it must precede the method call with the key word ____ and a dot (.). Failing to do so results in the subclass's version of the method being called.

super

The following is an explicit call to the superclass's default constructor.

super();

1. In an inheritance relationship, this is the general class.

superclass

True or False: A superclass reference variable can reference an object of a subclass that extends the superclass.

true

True or False: Constructors are not inherited.

true

True or False: In a subclass, a call to the superclass constructor can only be written in the subclass constructor.

true

True or False: The superclass constructor always executes before the subclass constructor

true

True or False: When a class contains an abstract method, the class cannot be instantiated.

true

All classes directly or indirectly inherit from this class.

Object

True or False: By default all members of an interface are public.

True

A Java ______ class can have class members like private, protected, etc.

abstract

Interface can have only ______ methods.

abstract

Abstract classes cannot__________.

be instantiated

Fields in an interface are __________.

both final and static

When a superclass does not have a default constructor or a programmer-defined no-arg constructor, the subclass's constructor must explicitly ____ _____of the constructors that the superclass does have.

call one

If a subclass's constructor does not explicitly call a superclass constructor, Java automatically _____ the superclass's no-arg constructor.

calls

With this type of binding, the Java Virtual Machine determines at runtime which method to call, depending on the type of the object that a variable references.

dynamic

This key word indicates that a class inherits from another class.

extends

True or False: A class may only implement one interface.

false

True or False: A subclass reference variable can reference an object of the superclass.

false

True or False: A super class has a member with package access. A class that is outside the superclass's package but inherits from the superclass can access the member.

false

True or False: An object of a superclass can access members declared in a subclass.

false

True or False: If a subclass constructor does not explicitly call a superclass constructor, Java will not call any of the superclass's constructors.

false

True or False: When a method is declared with the final modifier, it must be overridden in a subclass.

false


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

Natural History Self test 1,2,3 and Quiz 1

View Set

The Ultimate Exam Study Guide Stat 226

View Set

Chapter 17 - Gene Expression: Gene→Protein

View Set