Vergleich mit inneren Klassen

interface Fun { int app (int x); }
class Linear {
  static Fun linear (int a, int b) {
    return new Fun() { 
      int app (int x) { return a * x + b; }
  } }
  static int example() {
    Fun f = linear (4,5); 
    Fun g = linear (6,7);
    return f.app(8) + g.app(9);
} }
Fehler? Bytecode?



2010-10-12