A quick explainer on what Java constructors do first: they call another constructor. You can manually invoke this() or super(), but if you don't, the compiler automatically inserts a super() call. This means if a superclass lacks a no-arg constructor, you must explicitly call one or face a compiler error. If no constructor is written at all, the compiler generates a default no-arg constructor that calls super(). Also noted: JDK 25 introduces a change allowing super() to be called at any point in the constructor, removing the previous restriction.

1m watch time

Sort: