1
2
3
4
5
6
7public
8class Test {
9
10 public
11 static
12 void main(String[] argv) {
13 Expr drei =
14 new Const(3);
15
16 Expr e1 =
17 new BinaryPlus(
18 new Const(48),
19 new UnaryMinus(
20 new BinaryPlus(drei,drei)));
21
22 Expr e2 =
23 new BinaryMinus(
24 new Mult(
25 new Const(15),
26 drei),
27 drei);
28
29 System.out.println(e1 + " = " + e1.eval());
30 System.out.println(e2 + " = " + e2.eval());
31 }
32}
33
34