Diagram:// w w w . j ava2 s.c o m Animal | Mammal | +----------------+------+--------+----------------+ | | | | Cat Raccoon Fish Dog (implements (implements Washer) Washer)
Consider the following code:
1. Raccoon rocky;
2. Fish myFish;
3. Washer w;
4.
5. rocky = new Raccoon();
6. w = rocky;
7. myFish = w;
Which of the following statements is true? (Choose one.)
B.
The conversion in line 6 is fine (class to interface), but the conversion in line 7 (interface to class) is not allowed.
A cast in line 7 will make the code compile, but then at runtime a ClassCastException will be thrown, because Washer and Fish are incompatible.