A menu-driven Java application that demonstrates the fundamental operations of a stack using an array.
- Push: Add an element to the top of the stack.
- Pop: Remove the top element from the stack.
- Display: Show all elements currently stored in the stack.
- Overflow Handling: Prevent insertion when the stack is full.
- Underflow Handling: Prevent deletion when the stack is empty.
- Menu-driven interface for performing operations.
This project implements a stack using an array with a fixed capacity of 5 elements.
A stack follows the LIFO (Last In, First Out) principle. The last element inserted is the first element removed.
- Java
- Arrays
- Stack Data Structure
- Scanner Class
```text push_pop_display-stack/ ├── src/ │ └── Main.java └── README.md ```
-
Clone the repository:
```bash git clone https://github.com/ItsHardikSoni/push_pop_display-stack.git ```
-
Navigate to the project directory:
```bash cd push_pop_display-stack ```
-
Compile the Java program:
```bash javac -d out src/Main.java ```
-
Run the application:
```bash java -cp out Main ```
- Understanding the LIFO principle.
- Implementing stack operations using arrays.
- Using a variable to track the top position.
- Handling stack overflow and underflow conditions.
Ayush