<<< Default constructor | Index | Method overloading (Java) >>> |
Our objects can be constructed in many different ways.
For example, constructor of the class Planet could take a set of initial parameters, such as
number of satellites,
distance from the Sun,
planet mass.
int distance = 50000; int satellites = 14; double mass = 12345.67; Planet saturn = new Planet ( satellites, distance, mass );
<<< Default constructor | Index | Method overloading (Java) >>> |