Exercise 4

1 Prefix Final

We have a type Banana. Imagine that you want to make two instances of this banana, lightBanana and swedishBanana.

Is this allowed? Why / Why not?

1.1 Hint

"fixed" is declared final.


The class is not correct, since the value of fixed in the type Banana is already set to final.

1.2.1 Simulation of Bananas