第一段階完了しました。

This commit is contained in:
s-ohasi
2026-09-16 16:35:38 +09:00
parent 542af2a5d4
commit 48af3a3a99
3 changed files with 62 additions and 0 deletions

25
em-oop/src/Circle.java Normal file
View File

@@ -0,0 +1,25 @@
public class Circle extends Shape {
//Shapeクラスを継承
//フィールド作成
private double radius;
//コンストラクタ作成
public Circle(double radius) {
super("円");
this.radius = radius;
}
//メソッド作成
public double area() {
return Math.PI * radius * radius;
}
public void showInfo() {
super.showInfo();
System.out.println("(半径:" + this.radius + ")");
}
}