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
In questa pagina del sito puoi guardare il video online Java: Stack (LIFO: Last In First Out) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato HowTo: 13 gennaio 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 815 volte e gli è piaciuto 3 spettatori. Buona visione!