![]() |
syntactic unit > access unit > constructor |
![]() ![]() | ||||
constructor | ||||
subject | fact |
constructor | always have the same name as the class | ![]() |
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 | ![]() | |
has definition A procedure that is called whenever a new object is created ![]() | ![]() | |
does not have a return type | ![]() | |
does not have a return type since it does not return a value | ![]() | |
does not return a value | ![]() | |
facilitates data abstraction | ![]() | |
has the same name as its class | ![]() | |
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 a subtopic of Constructors | ![]() | |
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 ![]() | ![]() | |
is a kind of access unit | ![]() | |
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 | ![]() |
Kinds of constructor :
Next access unit: interface Up: access unit Previous access unit: class