Imagem de fundo

Seja o seguinte programa Java:import java.util.*; public...

Seja o seguinte programa Java:


import java.util.*;


public class Main {


public static void main(String[] args) {

Stack<Integer> p1=new Stack<Integer>();

Stack<Integer> p2=new Stack<Integer>();

Stack<Integer> p3=new Stack<Integer>();

Stack<Integer> p4=new Stack<Integer>();


for (int i=100; i < 300; i+=50)

p1.push(i);

for (int i=70; i < 90; i+=10)

p2.push(i);

for (int i=45; i < 50; i+=2)

p3.push(i);


for( boolean x=false; !x; ) {

if (!p3.isEmpty())

p4.push(p3.pop());


else

x=true;

if (!p2.isEmpty())

p4.push(p2.pop());

else

x=x&&true;

if (!p1.isEmpty())

p4.push(p1.pop());

else

x=x&&true;


}

int val=0;

for (int i=0; i < 6; i++)

val=p4.pop();


System.out.println(val);

}

}


Quando a função main for executada, será exibido no console o valor


A

47


B

49


C

100


D

150


E

200