Skip to content

About

A menu-driven Java application demonstrating stack operations using an array, including push, pop, display, overflow, and underflow handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack Operations in Java

A menu-driven Java application that demonstrates the fundamental operations of a stack using an array.

Features

  • 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.

Data Structure

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.

Technologies Used

  • Java
  • Arrays
  • Stack Data Structure
  • Scanner Class

Project Structure

```text push_pop_display-stack/ ├── src/ │ └── Main.java └── README.md ```

How to Run

  1. Clone the repository:

    ```bash git clone https://github.com/ItsHardikSoni/push_pop_display-stack.git ```

  2. Navigate to the project directory:

    ```bash cd push_pop_display-stack ```

  3. Compile the Java program:

    ```bash javac -d out src/Main.java ```

  4. Run the application:

    ```bash java -cp out Main ```

Learning Outcomes

  • Understanding the LIFO principle.
  • Implementing stack operations using arrays.
  • Using a variable to track the top position.
  • Handling stack overflow and underflow conditions.

Author

Ayush

GitHub

About

A menu-driven Java application demonstrating stack operations using an array, including push, pop, display, overflow, and underflow handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages