/**Copyright (c) Balzert, H: "Java: Objektorientiert Programmieren" * W3L-Verlag Dortmund, 3. Auflage, 2014 * Closure, S. 340 */ public class Closure { @FunctionalInterface interface MathInteger { int berechne(int a, int b); } public static int ergebnis(int x, int y, MathInteger op) { return op.berechne(x, y); } public static void main(String[] args) { int c=10,d=20; int e=30; e = 35; System.out.println(ergebnis(c, d, (c1, d1) -> c1 - d1 * e)); System.out.println(ergebnis(c, d, (c1, d1) -> c1 / d1 + e)); } }