0
How can I create a stack in java?
Java
2 Réponses
+ 5
To declare Stack in Java, first, start with keyword stack , followed by angle brackets, <> , that contain the data type of the stack elements. Then write the name of the stack and at last, write the keyword new to allocate memory to the newly created stack. The syntax for declaring a Stack in Java is: <stack> .
Ref here:
https://www.educative.io/edpresso/how-to-use-the-stack-class-in-java
https://www.geeksforgeeks.org/stack-class-in-java/amp/
https://www.javatpoint.com/java-stack
+ 1
Stack class is available in java util package
Otherwise we can create owr own class and methods for stack