Java View all facts Glossary Help |
syntactic unit > access unit > constructor > default constructor |
default constructor | ||||
subject | fact |
default constructor | has definition A constructor that is automatically provided by the runtime system for any class that contains no explicit constructors | |
has no parameters | ||
is a subtopic of Constructors | ||
is a kind of constructor | ||
constructor | can be overloaded using method name overloading | |
can call another constructor in the same class, instead of the superclass's zero-parameter constructor, by adding a new statement (as the first statement in the constructor) consisting of the keyword this followed by an argument list | ||
can call another constructor in the superclass, instead of the superclass's zero-parameter constructor, by adding a new statement (as the first statement in the constructor) consisting of the keyword super followed by an argument list | ||
can not be called directly | ||
can not return a value | ||
can use a constructor of the class's superclass with a super() call | ||
does not return a value | ||
facilitates data abstraction | ||
has example // Example of creation of an account with an initial balance | ||
has example //Example of constructor for the class Stack | ||
has purpose to initialize the instance variables of a newly created object and perform any other needed initialization | ||
has typically 1 or more arguments that determine some of the values of the variables of the class | ||
is not a member | ||
is not a method | ||
is called when the new operator is used to create an instance of a class | ||
is not inherited by a subclass | ||
is part of class | ||
may have access modifier | ||
normally calls the zero-parameter constructor in the direct superclass first | ||
provides a way to initialize a new object | ||
access unit | has access mode | |
syntactic unit | has syntax rule bold = mandatory |
Next constructor: constructor with no parameters Up: constructor