8000 Create README.md · ruturajjadhav07/Java@b187a48 · GitHub
[go: up one dir, main page]

Skip to content

Commit b187a48

Browse files
Create README.md
1 parent dc3b16c commit b187a48

File tree

  • Java Core/Java Collection Framework/List/Stack

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Stack
2+
*Stack is class and implements the List interface, making it a part of the Java Collections Framework.Stack utilizes an underlying dynamic array to store elements, allowing for the storage of objects of various data types. Like ArrayList, Stack can store duplicate elements.*
3+
4+
*A Stack follows the Last-In-First-Out (LIFO) principle, meaning the most recently added element is the first one to be removed.
5+
When you add elements to a Stack using the push method, they are added to the top of the stack. However, when you retrieve elements using the pop method, it removes and returns the topmost element of the stack.*
6+
7+
*Elements stored in a Stack can only be accessed from the top of the stack. This means that the last element added to the stack is the first one to be removed, stick to the LIFO principle.*
8+
9+
## There are many methods related to ArrayList Here are most common that are used
10+
### push(E item):
11+
* Adds the specified element to the top of the stack.
12+
13+
### pop():
14+
* Removes and returns the top element from the stack.
15+
16+
### empty():
17+
* Returns true if the stack is empty; otherwise, returns false.

0 commit comments

Comments
 (0)
0