Why does this() and super() have to be the first statement in a constructor?

Ulf Zibis Ulf.Zibis at gmx.de
Tue Oct 11 02:45:59 PDT 2011


Am 11.10.2011 02:54, schrieb Per Bothner:
> .....
> or:
>
>       class A extends Base {
>            A() { super(specialFoo()); }
>            private static Foo specialFoo() {
>                Foo foo = new Foo;
>                foo.special_init();
>                return foo; }
>           }
>       }
BTW: this is the same as:
(If special_init() would return foo itself, of if we would have method invocation chaining: ...
http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001180.html))

      class A extends Base {
           A() { super((new foo()).special_init()); }
      }





More information about the coin-dev mailing list