✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
¿Cuál es la salida del siguiente programa (que compila y ejecuta correctamente)?
import java.util.*;import java.util.concurrent.*;public class TestEx_a_ene18{ public static void main(String[] args) { Stack<Integer> pila=new Stack(); int r; for(int i=1; i<6; i++) pila.push(i); r=metodo(pila); System.out.println(r+" "+pila.size()); } public static int metodo(Stack<Integer> pila) { int x=1,n; while(!pila.isEmpty()) { n=pila.pop(); if(n % 2==0) x=x*n; else x=x+n; } return x; }}