не понял... а как вот так мы просто через this добавляем 3 параметр?
this(...) передает в метод или в начальные переменные если в другом методе?
а если я захочу еще 1 или 2 this( 5, 5, 5, 1, 1) ?
public class Circle {
public double x;
public double y;
public double radius;
public Circle(double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
}
public Circle(double x, double y) {
this(x, y, 10);
}
public Circle() {
this(5, 5, 1);
}
public static void main(String[] args) {
Circle circle = new Circle();
System.out.println(circle.x + " " + circle.y + " " + circle.radius);
Circle anotherCircle = new Circle(10, 5);
System.out.println(anotherCircle.x + " " + anotherCircle.y + " " + anotherCircle.radius);
}
}