| 1 |
package test0028; |
| 2 |
|
| 3 |
public abstract class X { |
| 4 |
|
| 5 |
void foo(String[] args) { |
| 6 |
if (args.length < 2) { |
| 7 |
System.out.println("Usage: X <double> <double>"); |
| 8 |
return; |
| 9 |
} |
| 10 |
double x = Double.parseDouble(args[0]); |
| 11 |
double y = Double.parseDouble(args[1]); |
| 12 |
|
| 13 |
for (X op : X.values()) |
| 14 |
System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y)); |
| 15 |
} |
| 16 |
|
| 17 |
// Perform the arithmetic X represented by this constant |
| 18 |
abstract double bar(double x, double y); |
| 19 |
|
| 20 |
static X[] values() { |
| 21 |
return null; |
| 22 |
} |
| 23 |
|
| 24 |
abstract double eval(double x, double y); |
| 25 |
} |