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

public static void main(String[] args){
Stack s1= new Stack (10);
Stack s2 new Stack(10);
for (int i =0; i <10; i++)
s1.push(i++);
s2.push(s1.top());
s1.pop();
s2.push(sl.top());
s1.pop();
s2.push(s1.top());
s1.pop();
System.out.println(s1.top());
System.out.println(s2.top());
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!