| Author |
Possible error in a mock exam
|
Gilles Marceau
Ranch Hand
Joined: Feb 17, 2007
Posts: 78
|
|
Hello guys, i think i have found an error i a mock exam, which can be found at this link : http://www.javabeat.net/javabeat/scjp5/mocks/MockExam02.php Please be nice, if i am wrong, i am just a SCJP student, not a java guru. This is about the question 11, reproduced here : 11. Given: 1. import java.util.*; 2. public class Fruits { 3. public static void main(String [] args) { 4. Set c1 = new TreeSet(); 5. Set o1 = new TreeSet(); 6. bite(c1); 7. bite(o1); 8. } 9. // insert code here 10. } 11. class Citrus { } 12. class Orange extends Citrus { } Which, inserted independently at line 9, will compile? (Choose all that apply.) A). public static void bite(Set<?> s) { } B). public static void bite(Set<Object> s) { } C). public static void bite(Set<Citrus> s) { } D). public static void bite(Set<? super Citrus> s) { } E). public static void bite(Set<? super Orange> s) { } F). public static void bite(Set<? extends Citrus> s) { } G). Because of other errors in the code, none of these will compile. The right answers should be : A, E, and F, but i tried to compile the answers A to F, and in fact, all of them compile ! Some of them with warning (about unchecked conversion), some others without. By the way, many thanks to K.Sierra and B.Bates for their books (i got Java Head First, Design Pattern in Java, and the SCJP study guide book). Feel free to correct me if i am wrong, after all, i am here to learn. [ February 18, 2007: Message edited by: Gilles Marceau ] [ February 18, 2007: Message edited by: Gilles Marceau ] [ February 18, 2007: Message edited by: Gilles Marceau ]
|
SCJP 1.5<br />SCJD 1.6<br />SCBCD in progress...
|
 |
 |
|
|
subject: Possible error in a mock exam
|
|
|