3段階目
This commit is contained in:
@@ -1,20 +1,41 @@
|
||||
//
|
||||
//public abstract class Shape {
|
||||
//
|
||||
// private String name;
|
||||
//
|
||||
// public Shape(String name) {
|
||||
// this.name = name;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public abstract double area();
|
||||
// //return 0.0;
|
||||
//
|
||||
//
|
||||
//
|
||||
// public void showInfo() {
|
||||
// //System.out.println(this.name + "の面積は" + this.area() + "です");
|
||||
//
|
||||
// }
|
||||
public class Shape {
|
||||
|
||||
public abstract class Shape {
|
||||
|
||||
//フィールド作成
|
||||
private String name;
|
||||
|
||||
|
||||
//コンストラクタ作成
|
||||
public Shape(String name) {
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public abstract double area();
|
||||
//return 0.0;
|
||||
|
||||
|
||||
|
||||
public void showInfo() {
|
||||
//System.out.println(this.name + "の面積は" + this.area() + "です");
|
||||
|
||||
|
||||
//メソッド作成
|
||||
double area() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//メソッド作成
|
||||
void showInfo() {
|
||||
//出力
|
||||
System.out.println(this.name + "の面積は" + this.area() + "です");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user