Oracle
1Z0-809 · Question #264
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…
The correct answer is A. Foo<String, Integer> mark = new Foo<Object, Object>("Steve", 100). You've hit your session limit · resets 5:20pm (America/New_York)
Question
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?
Options
- AFoo<String, Integer> mark = new Foo<Object, Object>("Steve", 100);
- BFoo<String, String> pair = Foo.twice("Hello World");
- CFoo<Object, Object> percentage = new Foo<Object, Object>("Steve", 100);
- DFoo<String, String> grade = new Foo <> ("John", "A");
How the community answered
(23 responses)- A83% (19)
- B4% (1)
- C9% (2)
- D4% (1)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.