1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public interface Executable {
int execute(int a, int b);
double execute(double a, double b);
}
public abstract class MonAdapter implements Executable {
public int execute(int a, int b) {
// ou levée d'une exception
System.out.println("Not implemented");
return -1;
}
public double execute(double a, double b) {
// ou levée d'une exception
System.out.println("Not implemented");
return -1;
}
}
class Addition extends MonAdapter {
public int execute(int a, int b) {
return a + b;
}
}
class Multiplication extends MonAdapter {
public double execute(double a, double b) {
return a * b;
}
} |
Partager