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
Sur cette page du site, vous pouvez voir la vidéo en ligne Java: Stack (LIFO: Last In First Out) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur HowTo: 13 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 815 fois et il a aimé 3 téléspectateurs. Bon visionnage!