Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public static void main ( String [ ] args ) 1 stack s 1 = new Stack ( 1 0 ) ; stack s 2

public static void main(String[] args)1
stack s1= new Stack(10);
stack s2= new stack(10);
for (int i=0;i10;i++ s1. push (i++) ;
s2. push (s1.top()) ;
s1. pop () ;
s2. push (s1.top()) ;
s1. pop() ;
s2. push (s1.top()) ;
s1. pop () ;
System.out.println(s1.top ()) ;
system. out.println(s2.top());
}
Your answer:
1
4
1
3
1
2
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions