Java MCQ: What is the List interface in Java?
a) A collection that stores elements in an ordered sequence
b) A collection that does not allow duplicates
c) A collection that maps keys to values
d) A collection that supports random access
Answer:
a) A collection that stores elements in an ordered sequence
Explanation:
The List
interface in Java is a subtype of the Collection
interface that stores elements in an ordered sequence. Lists allow duplicate elements and provide positional access to elements using indices.
Understanding the List
interface is essential for working with ordered collections of elements in Java, such as ArrayList
and LinkedList
.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html