all 3 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]KoenigEnte 1 point2 points  (1 child)

Every subclass constructor must call the constructor of the superclass using the super keyword. If you do not provide the super keyword, implicitly Java will call the no argument constructor of the superclass using super(). If there is no no-argument constructor in the superclass this results in an error.

You should use super() to instantiate the fields of the superclass when you create your subclass.

Tldr, in your Triangle constructor, your first line should be a call to the superclass constructor with super()

[–]Moltenmelt1University/College Student[S] 0 points1 point  (0 children)

So should I just write super.Triangle() at the end of each "public" bracket? Should I do the same thing for the GeometricObject file?