Given:
public class Foo<K, V> {
private K key;
private V value;
public Foo (K key, V value) (this.key = key; this value = value;) public static <T> Foo<T, T> twice (T value) (return new Foo<T, T> (value, value); ) public K getKey () (return key;) public V getValue () (return value;)
}
Which option fails?
Foo<String, Integer> mark = new Foo<String, Integer> ("Steve", 100););
A.
B. Foo<String, String> pair = Foo.<String>twice ("Hello World!");
Foo<?, ?> percentage = new Foo <> (97, 32););
C.
D. Foo<String, String> grade = new Foo <> ("John", "A");
adnano1234
Highly Voted 6 months, 3 weeks agoInnovation
Most Recent 6 months, 3 weeks ago