Created
January 20, 2014 06:55
-
-
Save rayjcwu/8516073 to your computer and use it in GitHub Desktop.
Which one of the following is a legal statement?
1. InventoryItem inv = new Perishable();
2. Perishable p = new PRoduce();
3. Produce p = new Fruit();
4. Produce p = new Produce();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Perishable { | |
int daysRemaining(); | |
} | |
class InventoryItem {} | |
abstract class Produce extends InventoryItem implements Perishable {} | |
class Fruit extends Produce { | |
@Override | |
public int daysRemaining() { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment