Site Search:

OCPJP Simulation Test 45

<Back to OCPJP





Question: Suppose the following methods are defined within a generic class
public class<T t> test{...} and all the needed import are there.
Which of the following code snippets compile?

Choice:
A. public static <T, U>void grab(U t) {}
B. public static <T>T self(T t) {return t;}
C. public static <T, U> T process(T t, List<U> s) {return t;}
D. public static <T> T processes(T t, T s) {return t;}
E. public void takes(T t) {}
F. public static <U> void grabs(T t) {}
G.public T check(T t) {return T;}
H. public <U>U checks(U u) {return u;}