Skip to content

Ezzoubeir03/Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

import java.util.Stack;

class Scratch { public static void main(String[] args) { // Create a Stack of integers Stack stack = new Stack<>();

    // Push elements onto the stack
    stack.push(1);
    stack.push(2);
    stack.push(3);

    // Display the top element of the stack
    System.out.println("Top element (peek): " + stack.peek());

    // Display the size of the stack
    System.out.println("Stack size: " + stack.size());

    // Pop the top element and display it
    System.out.println("Popped element: " + stack.pop());

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published