Alguien me puede ayudar a correjir el código es que cuando ejécuto 2+1 sale ERROR | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Alguien me puede ayudar a correjir el código es que cuando ejécuto 2+1 sale ERROR

package clase; import java.util.Stack; import javax.swing.JOptionPane; public class Metodo_main { public static void main (String args[]){ String cadena = JOptionPane.showInputDialog("ingresar una operacion"); Stack <Character> Compilacion = new Stack <Character>(); for (int F = 0; F < cadena.length(); F++) { Compilacion.push(cadena.charAt(F)); int j = 0; Character aux; while(Compilacion.empty() == false ){ aux = Compilacion.pop(); if (j==0) { j++; if (aux == '+') { System.out.println("Error"); } } } } } }

17th Mar 2021, 7:24 PM
Felipe Villamil
Felipe Villamil - avatar
0 Answers