CSE 115 Lecture Notes - Lecture 36: Pariah Dog
Document Summary
Defining more than one constructor for a class is an example of overloading. Generally, a name can be overloaded with multiple definitions, as long as the correct interpretation of the name can be determined by the compiler from context. Methods and constructors can be overloaded as long as the name can be disambiguated based on the call. If no explicit constructor is defined for a class, the compiler provides one. This default constructor takes no arguments and has an empty body public class b { public b() { super(); Any constructor which does not explicitly call a superclass constructor implicitly invokes the no-argument constructor of the superclass. An explicit invocation of a superclass constructor is done using super". The first statement in a constructor must be a call to a constructor. Often this call is to a superclass constructor, but it can be to another constructor of the same class.