Java Package
© examsnet.com
Question : 9
Total: 16
place the code into the GenericB class definition to make the class compile successfully.
Code to place
import java.util.*;
public class GenericB < (1)___ > {
public (2)___ foo;
public void setFoo( (3)___ foo ) {
this.foo = foo;
}
public (4)___ getFoo() {
return foo;
}
public static void main (String [] args) {
GenericB < cat > bar = new GenericB < cat > ();
bar. setFoo (new Cat ());
cat c = bar. getFoo();
}
}
interface pet { }
class Cat implements Pet { }
Code to place
(A) ? extends Pet | (B) T extends Pet |
(C) ? implements Pet | (D) T implements Pet |
(E) Pet extends T | (F) ? |
(G) T | (H) < ? > |
(I) Pet |
Go to Question: