Forums Register Login

Tough Chisholm Question!

+Pie Number of slices to send: Send
Exam 17, Q2
import java.util.*;
class I {
public static void main (String[] args) {
Object i = new ArrayList().iterator();
System.out.print((i instanceof List)+",");
System.out.print((i instanceof Iterator)+",");
System.out.print(i instanceof ListIterator);
}}
Are we really expected to know *how* the Collection classes are implemented?
The result of i instanceof ListIterator returns false in this case. However, if the collection was instead a LinkedList, it would return true! (LinkedList simply forwards its iterator method to its listIterator method.
I think a fairer question would be based merely around the Iterators themselves assuming that it wishes to test knowledge of which of the iterators is a subinterface of which.
Thanks to Dan BTW for creating so many questions which really make you think! I've been scoring in the 90-100% mark in most of the other test exams I've taken - it's been down to 60-75% on average on Dan's questions...
+Pie Number of slices to send: Send
After thinking about this, I don't think that this level of detail is something that you really need to know for the test.
[ October 17, 2003: Message edited by: Thomas Paul ]
+Pie Number of slices to send: Send
Anthony,
I think you're right. That question is a little beyond the scope. I'll replace it with a new question sometime soon.
+Pie Number of slices to send: Send
Thanks to Dan BTW for creating so many questions which really make you think! I've been scoring in the 90-100% mark in most of the other test exams I've taken - it's been down to 60-75% on average on Dan's questions...
You're more than ready for the exam
+Pie Number of slices to send: Send
 

You're more than ready for the exam


Cool - it's on Tuesday
+Pie Number of slices to send: Send
I agree. You're more than ready.
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 708 times.
Similar Threads
The New for Loop, Iterators and Unsupported Operation Exceptions on List.remove()
Using Enumeration/Iterator over looping around,
Iterator vs for loop
Collections which iterate bi-directionally?
Methods that return interfaces
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:58:56.