Which of the following declarations and initializations will not cause a compiler error?

Consider the following inheritance hierarchy that is used in a video game.

```
Character
/ \
Friend Villain
/ \ / \
WiseMan ShopKeeper Dragon Skeleton
| |
FlyingDragon EliteSkeleton
```

```
Character c = new FlyingDragon();
FlyingDragon f = new Character();
Dragon d = new Villain();
Villain v = new Skeleton();
Dragon d = new ShopKeeper();
```

What will be an ideal response?


The following are valid for this inheritance hierarchy because of the is-a relationship.
```
Character c = new FlyingDragon();
Villain v = new Skeleton();
```

Computer Science & Information Technology

You might also like to view...

Which of the following is NOT true of SSL?

A. It is a transport-layer protocol. B. It is compatible with TLS. C. SSL v2 must be used for client-side authentication. D. The two options are 40-bit and 128-bit.

Computer Science & Information Technology

When does Active Directory online defragmentation occur?

What will be an ideal response?

Computer Science & Information Technology

The string class stores an immutable series of characters--meaning once you assign a string reference a value, that referenced location's value cannot be modified.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A(n) ______ is a Java construct that enables a programmer to define a new data type.

a) class b) method c) data field d) object

Computer Science & Information Technology