16. Inheritance Flashcards

1
Q

What two steps are needed to delete an element in a partially filled array?

A

ss

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

What is UML short for?

A

ss

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

In the representation for a class, how are public items distinguished from private ones?

A

ss

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

What four values are used to generate a colour?

A

ss

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

If the relationship ‘A is a B’ is modelled by two classes A and B, which is the superclass and which is the subclass?

A
A is a subclass
B is a superclass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do we invoke the constructor of the superclass, and when?

A

ss

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

When do we invoke the constructor of the superclass implicitly?

A

ss

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

What kinds of method can be overridden? Can the new version have a different body? Different parameters? Different name?

A

ss

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

What simple errors is the @Override annotation protect us from?

A

ss

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

If an object is polymorphic, what does that mean? And how do we achieve it?

A

ss

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

In what sense might a method be dynamically bound? Which types of method have this feature?

A

ss

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

In what way does a subclass extend its superclass?

A

ss

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

How do we make a class abstract, and what can we not do with it when we have made it abstract?

A

ss

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

How do we define an abstract method, and when do we? In what sense do we not override an abstract method?

A

ss

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

What does it mean to make a method final, and how do we achieve it? What kinds of method can be made final? What about a final class?

A

ss

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

How do we create an extension of a class which has more state?

A

ss

17
Q

How is the idea of adding more instance methods related to adding more object state?

A

ss

18
Q

How do we determine if an object is an instance of a particular class?

A

ss

19
Q

What is the essential difference between a class cast and primitive type cast?

A

ss

20
Q

Which of the following models ‘is a’ and which models ‘has a’?

1. 
public class DieselTrain extends Train { 
}
  1. public class Train {
    private Carriage[] carriages;
    }
A

ss

21
Q

When might we want to use an overridden method, and how do we?

A

ss

22
Q

What is the purpose of constructor chaining?

A

ss

23
Q

When do we invoke another constructor from the same class, and how?

A

ss

24
Q

What exactly is a default constructor, and when do we get one?

A

ss

25
Q

All classes, except Object, have something. What is that thing?

A

ss

26
Q

What does this default Object: toString() produce?

A

ss

27
Q

Assuming a point class defined as one might expect, what is the affect of the following code?

System.out.println(new Point(10, 20));

A

ss