December 2003
Beginner
288 pages
7h 8m
English
This Cabbie class contains two constructors. We know they are constructors because they have the same name as the class: Cabbie. The first constructor is the default constructor:
public Cabbie() {
name = null;
myCab = null;
}
Technically, this is not a default constructor. The compiler will provide a default constructor if you do not specify a constructor for this class. By definition, the reason it is called a default constructor here is because it is a constructor with no arguments. If you provide a constructor with arguments, the system will not provide a default constructor. The rule is that the default constructor is only provided if you provide no constructors.
In this constructor, the attributes Name and myCab are set to ...
Read now
Unlock full access