Examveda

What is the primary difference between a `Stack` and a `Queue` in the Java Collections Framework?

A. A `Queue` allows duplicate elements, while a `Stack` does not

B. A `Stack` allows duplicate elements, while a `Queue` does not

C. A `Queue` uses a LIFO order, while a `Stack` uses a FIFO order

D. A `Stack` uses a LIFO (Last-In-First-Out) order, while a `Queue` uses a FIFO (First-In-First-Out) order

Answer: Option D


This Question Belongs to Java Program >> Collections Framework In Java

Join The Discussion

Related Questions on Collections Framework in java