logo

Crowdly

Browser

Add to Chrome

¿Cuál es la salida del siguiente programa (que compila y ejecuta correctamente)...

✅ 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.Stack;

public class TestEx_d_ene19

{

  public static void main(String args[]) {

    Stack a=new Stack(),b=new Stack();

    char c[]={'a','e','i','o','u'};

 

    for(int h=0; h<5; h++) {

      a.push(c[h]);

      b.push(a.pop());

    }

    metodo(a,b);

    if(a.size()==b.size())

      System.out.println(a.toString()+" "+a.size());

    else

      System.out.println(b.toString()+" "+b.peek());

  }

  static void metodo(Stack s1, Stack s2) {

    if(s2.pop().equals('u'))

      s2.push(s2.peek());

    else

      s2.push('x');

  }

}

More questions like this

Want instant access to all verified answers on campusvirtual.uclm.es?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome