Campbell Ritchie wrote:If you look in the Java® Language Specification (=JLS), you will find that your superclass does indeed have a no‑arguments constructor.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:.... (which we are actively working on.) ...
Oracle Certified Professional Java SE 8
I presume that means constructors with arguments only. The subclass's constructor must then start this(something); or super(something); and it is the super(something); part that causes the problem in question.Jeanne Boyarsky wrote:. . . They key point is that if the parent defines a constructor, the child needs to as well.
Jeanne Boyarsky wrote:It's on page 243. They key point is that if the parent defines a constructor, the child needs to as well.
Campbell Ritchie wrote:
I presume that means constructors with arguments only. The subclass's constructor must then start this(something); or super(something); and it is the super(something); part that causes the problem in question.Jeanne Boyarsky wrote:. . . They key point is that if the parent defines a constructor, the child needs to as well.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:It's on page 243. They key point is that if the parent defines a constructor, the child needs to as well.
Brecht Geeraerts wrote:I assume you are referring to this rule (from the book):
Constructor definition rules:
4) If the parent doesn’t have a no-argument constructor and the child doesn’t define any constructors, the compiler will throw an error and try to insert a default no-argument constructor into the child class.
Campbell Ritchie wrote:
I presume that means constructors with arguments only. The subclass's constructor must then start this(something); or super(something); and it is the super(something); part that causes the problem in question.Jeanne Boyarsky wrote:. . . They key point is that if the parent defines a constructor, the child needs to as well.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |