Ch 10 - Gaddis Flashcards

1
Q

Inheritance

A

Inheritance allows a new class to extend an existing class. The new class inherits the members of the class it extends. The Java API has a class named Object, which all other classes directly or indirectly inherit from.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

super

A

The super keyword refers to an object’s superclass. You can use the super key word to call a superclass constructor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Overriding superclass methods

A

A subclass may have a method with the same signature as a superclass method. In such a case, the subclass method overrides the superclass method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Protected members

A

Protected members of a class may be accessed by methods in a subclass, and by methods in the same package as the class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Chains of inheritance

A

A superclass can also inherit from another class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Polymorphism

A

A superclass reference variable can reference objects of a subclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Abstract classes & abstract methods

A

An abstract class is not instantiated, but other classes extend it. An abstract method has no body and must be overridden in a subclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Interface

A

An interface specifies behavior for a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Anonymous inner classes

A

An inner class is a class that is defined inside another class. An anonymous inner class is an inner class that has no name. An anonymous inner class must implement an interface, or extend another class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Functional interfaces & lambda expressions

A

A functional interface is an interface that has one abstract method. You can use a special type of expression, known as a lambda expression, to create an object that implements a functional interface (Java 8).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly