DEV/DEV3.2/TP7/Prefixe/Main.java

24 lines
540 B
Java
Raw Permalink Normal View History

2023-11-29 17:27:03 +01:00
import java.util.*;
public class Main {
protected static ArrayDeque<String> pile;
public static void main(String[] args) {
Main.pile = new ArrayDeque(args.length);
for (int i=0; i<args.length; i++){
Main.pile.push(args[i]);
}
Noeud noeudDeb;
String debutArbre = Main.pile.pop();
if (debutArbre.equals("+")||debutArbre.equals("-")||debutArbre.equals("x")||debutArbre.equals("/")){
noeudDeb = new NoeudOperation(debutArbre);
}
else{
noeudDeb = new NoeudChiffre(debutArbre);
}
noeudDeb.afficherNoeud();
}
}