Stack and Queue in Java with examples
Consider a table with a stack of plates. After the first one is placed on the table, the next one is placed on top of it; the third one is placed on top of the second, and so on, until the desired number is reached. To take the dishes off the table one by one, start with the last one placed on top; then move on to the last-but-one; then the one next to the top; and so on.