Discuss / Java / 练习1

练习1

Topic source

Kataknight

#1 Created at ... [Delete] [Delete and Lock User]

import java.util.*;

public class Main {

    public static void main(String[] args) {

        String exp = "1 + 2 * (9 - 5)";

        SuffixExpression se = compile(exp);

        int result = se.execute();

        System.out.println(exp + " = " + result + " " + (result == 1 + 2 * (9 - 5) ? "✓" : "✗"));

    }

    static SuffixExpression compile(String exp) {

        // TODO:

        return new SuffixExpression();

    }

}

class SuffixExpression {

    int execute() {

        // TODO:

        return 0;

    }

}

  • 1

Reply