-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCircle.java
More file actions
28 lines (25 loc) · 764 Bytes
/
Circle.java
File metadata and controls
28 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Circle implements Shape {
private String color;
private double radius;
public Circle(String color, double radius) {
this.color = color;
this.radius = radius;
System.out.println("Circle is Created");
}
@Override
public Shape makeCopy() {
System.out.println("Circle is Being Made");
Circle clonedCircle = null;
try {
clonedCircle = (Circle) super.clone();
} catch (CloneNotSupportedException e) {
System.out.println("The Circle was Turned to Mush");
e.printStackTrace();
}
return clonedCircle;
}
@Override
public String toString() {
return "Circle color: " + color + ", radius: " + radius;
}
}