QUESTION
Question
Problem1. Write a java program that will PUSH and POP element using Stacks.
Filename: StackPushPop.java
ANSWERS:
Step 1
The Java Code is given Below:
Step 2
Code:
import java.util.*;
public class StackPushPop
{
public static void main(String args[])
{
//creating an object of Stack class
Stack <Integer> stk = new Stack<>();
System.out.println(“stack: ” + stk);
//pushing elements into the stack
pushelmnt(stk, 10);
pushelmnt(stk, 15);
pushelmnt(stk, 20);
pushelmnt(stk, 30);
pushelmnt(stk, 35);
pushelmnt(stk,