LinkedList push and pop methods

Adding and removing element in LinkedList can also be done by push and pop methods.

1. void  push(E e) – Adds an element into the List as the first element

2. E pop() – Removes the first element of the list.

Lets see some examples on LinkedList push and pop methods.

LinkedList push and pop methods

Output

Reference

LinkedList Api