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?
You cannot define interface for constructors in Java. Nor you cann put any other constraints to type parameters, other than type variance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With