Multiple Constructors : Constructor « Class Definition « Java Tutorial






class Sphere {
  int radius = 0;

  Sphere() {
    radius = 1;
  }

  Sphere(int radius) {
    this.radius = radius;
  }
}








5.2.Constructor
5.2.1.Using Constructors
5.2.2.The Default Constructor
5.2.3.Multiple Constructors
5.2.4.Calling a Constructor From a Constructor
5.2.5.Duplicating Objects using a Constructor
5.2.6.Class Initializer: during declaration
5.2.7.Order of constructor calls