About 389,000 results
Open links in new tab
  1. Using Java Stack with String elements

    Dec 1, 2016 · I'm trying to use a java Stack to push String values:names into it, derived from input from a Scanner method. I'd then want to pop the names from the stack, and after show the …

  2. Stack Class in Java - GeeksforGeeks

    Apr 15, 2025 · Design a stack with the following operations. push(Stack s, x): Adds an item x to stack s pop(Stack s): Removes the top item from stack s merge(Stack s1, Stack s2): Merge …

  3. Stack toString() method in Java with Example - GeeksforGeeks

    Dec 24, 2018 · The toString () method of Java Stack is used to return a string representation of the elements of the Collection.

  4. Stack (Java Platform SE 8 ) - Oracle

    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack.

  5. Printing Stack Values in Java - Baeldung

    May 4, 2025 · Unlike Stack, Deque naturally maintains LIFO order while offering improved concurrency support. It is also the preferred choice in modern Java programming. However, …

  6. Java Program to Reverse a String using Stack - GeeksforGeeks

    Oct 21, 2020 · In Java, reversing a string means reordering the string characters from the last to the first position. Reversing a string is a common task in many Java applications and can be …

  7. The Stack in Java - Programmathically

    Jun 21, 2021 · Using the Java collections module you can create a stack using the dedicated stack class. ... import java.util.Stack; ... Stack stack = new Stack (); Now that the stack has …

  8. java - Turn stack into a string? - Stack Overflow

    I'm working on a project for class and we need to create a method that takes the stack we created and when called print itself out as a string. This is what I have so far; the method is at the …

  9. Java Stack - Jenkov.com

    May 21, 2020 · The Java Stack class is a classical stack data structure, where elements can be pushed onto the top of the stack, and popped off the top again. This Java Stack tutorial …

  10. JAVA - How do you push a string into a stack? - Stack Overflow

    Jun 2, 2017 · I have an assignment to push Strings into a stack. I created a program that will store numbers but I cannot figure out the correct way to define the array to take a string. Here is my …

  11. Some results have been removed