posted 16 years ago
There is a subtle mistake in that; a constructor can't access superclass members if they are marked private.
The way I think of it is that every object has a part which "belongs to" itself and a part "which is" its superclass. [I am sure it's not accurate however.] You have to set up the "superclass" part first, so you call the superclass constructor with super(123, 456, "Campbell");
You can also write this() to call overloaded constructors in the same class.
The this() and super() calls must be the first statement in the constructor, so you can't call this() and super() in the same constructor. Every path through the constructors must call super() eventually. If you write super.name = "Campbell"; you ought to get a compiler error because the name field in the superclass ought to have been declared private.
If you don't write super() the compiler will assume you mean it and insert a super() call anyway.