package com.codegym.task.task05.task0521;
/*
Calling a constructor from a constructor
*/
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) {
//write your code here
this(x, y, 5);
this.x = x;
this.y = y;
this.radius = 10.0;
}
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);
}
}
i'm not getting this please help me to overcome.
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Manjunath Deva
4 October 2018, 18:57
how can i????
0
Jaisingh
4 October 2018, 18:29
if you don't mind could you post the full task ??
0