Collections and Generics

© examsiri.com
Question : 47 of 53
 
Marks: +1, -0
Given:
interface Hungry < E > { void munch(E x); }
interface Carnivore < E extends Animal > extends Hungry < E > {}
interface Herbivore extends Hungry < E > {}
abstract class Plant {}
class Grass extends Plant {}
abstract class Animal {}
class Sheep extends Animal implements Herbivore < Sheep > {
  public void munch(Sheep x) {}
}
class Wolf extends Animal implements Carnivore < Sheep > {
  public void munch(Sheep x) {}
}

Which of the following changes (taken separately) would allow this code to compile?(Choose all that apply.)
Go to Question: