Bound Parameters

It is possible specifying more exactly the type used:

public class WithGeneric<T>;

public class WithGenericNumber<T extends Number>;
// Valid
new WithGeneric<String>();

// Compile error
new WithGenericNumber<String>();

Multiple Bounds

public class WithGeneric<T extends A & B & C>;

Last updated