I have declared a Class Animal . And I have an interface Interface1. When I try to use a reference of this class in any method (let's take main method it gives a compile error)
public interface Interface1 {}
public class Animal<T extends Interface1> {}
public static <T> void main(String[] args) {
//Below line gives a compile error
Animal<T> cc=null;
}
My question is:: in the main method type parameter T can also be a class or interface that extends Interface1 or is Interface1. So it should not give me a compile error.