Question 117 of 130 from exam 1Z0-809: Java SE 8 Programmer II

Question 117 of 130 from exam 1Z0-809: Java SE 8 Programmer II

Question

Given the code fragment:

ProductCode<Number, Integer> cl = new ProductCode<Number, Integer>()# /* cl
instantiation */
ProductCode<Number, String> c2 = new ProductCode<Number, String>(); /* c2
instantiation */

You have been asked to define the ProductCode class.

The definition of the ProductCode class must allow c1 instantiation to succeed and cause a compilation error on c2 instantiation.

Which definition of ProductCode meets the requirement? A.

class ProductCode<T, S<Integer>>
gel;
Bick;

B.

class ProductCode<T, S extends T>
Tel;
8.¢2;

C.

class ProductCode<T, S> {
Tcl
8 c2;

D.

class ProductCode<T, S super T> {
Tel
8 c2;

Explanations

B.