for the following interfaces and classes I have:
public interface Animal { //cant change this
public interface AnimalGroup<T extends Animal> { //cant change this
public class DogPack<T extends Animal> implements AnimalGroup<T> { //cant change implements AnimalGroup<T>
public class Dog implements Animal { //can change this
this works:
AnimalGroup<Animal> pack;
pack = new DogPack<Animal>();
this does not compile due to type mismatch: cannot convert from DogPack to AnimalGroup
AnimalGroup<Animal> pack;
pack = new DogPack<Dog>();
Can anyone offer any guidance as to why? I can get various combinations to work but not quite sure if the above does not work because Dog does not inherit/extend Animal (it cant)
Thanks