Multiple choice technology programming languages

Given: 11. // insert code here 12. private N min, max; 13. public N getMin() { return min; } 14. public N getMax() { return max; } 15. public void add(N added) { 16. if (min == null || added.doubleValue() max.doubleValue()) 19. max = added; 20. } 21. } Which two, inserted at line 11, will allow the code to compile? (Choose two.)

  1. public class MinMax<?> {

  2. public class MinMax<? extends Number> {

  3. public class MinMax<N extends Object> {

  4. public class MinMax<N extends Number> {

  5. public class MinMax<? extends Object> {

  6. public class MinMax<N extends Integer> {

Reveal answer Fill a bubble to check yourself
D,F Correct answer
Explanation

The type parameter N must extend Number to have the doubleValue() method. Option D (N extends Number) is correct. Option F (N extends Integer) also works since Integer extends Number and has doubleValue(). Options with ? are invalid because ? is a wildcard, not a type parameter name.