Java Programming - Objects and Collections - Discussion
Discussion Forum : Objects and Collections - Pointing out the correct statements (Q.No. 7)
7.
Which of the following are true statements?
- The Iterator interface declares only three methods: hasNext, next and remove.
- The ListIterator interface extends both the List and Iterator interfaces.
- The ListIterator interface provides forward and backward iteration capabilities.
- The ListIterator interface provides the ability to modify the List during iteration.
- The ListIterator interface provides the ability to determine its position in the List.
Answer: Option
Explanation:
The ListIterator interface extends the Iterator interface and declares additional methods to provide forward and backward iteration capabilities, List modification capabilities, and the ability to determine the position of the iterator in the List.
Discussion:
2 comments Page 1 of 1.
Ford Prefect said:
9 years ago
It's 2016, Java 7 is EOL already, so the Iterator interface has four methods, therefore C is correct, not B.
Bryan Pack said:
9 years ago
The answer could be either 'B' OR 'C' depending on the version of Java.
Iterator now has:
default void for EachRemaining(Consumer<? super E> action) in addition to boolean hasNext(), E next() & default void remove().
Iterator now has:
default void for EachRemaining(Consumer<? super E> action) in addition to boolean hasNext(), E next() & default void remove().
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers