Which constraint can be inserted at (1) so that the program compiles without warnings?
class NumClass <________________> { // (1) T numVal;/*from w ww . j a va 2s .c o m*/ } public class Main { public static void main(String[] args) { NumClass<Number> n1 = new NumClass<Number>(); NumClass<Integer> n2 = new NumClass<Integer>(); } }
Select the one correct answer.
(b)
None of the formal type parameter specifications with a wildcard are permitted.
This rules out (c) and (f).
The keyword super can only be used with a wildcard, and therefore rules out (d) and (e).
NumClass<Number>
is not a subtype of NumClass
<T extends Integer>, ruling out (a).