Introduction to Stack in Java.
A stack is a collection of objects that are inserted and removed in a LIFO(Last In First Out) fashion. So, when we need a plate, we take (pop) from the top of the stack, and when we want to add a plate, we put (push) it at the top as well. We cannot add or remove a plate at the middle of the stack.
We can perform various operations on stack other than push() and pop(). We can see the topmost element in the stack using peek(); we can know the size of the stack using the size() method. Also we can check if the stack is empty using the empty() method.
The Java collections framework has a Stack Class that provides the functionality of the Stack Data structure. The Stack class extends the Vector class.
LIFO or FILO? :)
00:05 - info
00:16 - Initialize the stack
00:37 - .empty()
00:53 - .push(e)
01:25 - .size()
01:39 - .peek()
02:00 - .pop()
#howto #java #easyway #firststep #stack #lifo #filo
Music track: Too Hot by Aylex
Source: https://freetouse.com/music
Free Background Music for Video
Auf dieser Seite können Sie das Online-Video Java: Stack (LIFO: Last In First Out) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer HowTo: 13 Januar 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 815 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!