Constraints in interface implementation in java
interface, java
Solution
Answering your updated question: only class can have a constructor in Java, T - is a type literal, it is not necessary has to be a class. During runtime using reflection you can check if your class is a ParameterizedType has a parameter that is actually a class and if it has an empty constructor.
Problem
Possible Duplicate: Java generics constraint require default constructor like C# I want to set a constraint to type T that it must have a constructor without parameters. In C# it will be like: ` public interface Interface<T> where T : new() { } ` Is this feature available in Java? Update: Is there some trick to make generic type T have a constructor?