段階2完了しました
This commit is contained in:
@@ -4,6 +4,10 @@ public class Day3Check1 {
|
||||
public static void main(String[] args) {
|
||||
Circle circle = new Circle(2);
|
||||
circle.showInfo();
|
||||
}
|
||||
Rectangle rectangle = new Rectangle(3,4);
|
||||
rectangle.showInfo();
|
||||
|
||||
Greeting greeting = new JapaneseGreeting();
|
||||
System.out.println(greeting.hello());
|
||||
}
|
||||
}
|
||||
|
||||
4
em-oop/src/Greeting.java
Normal file
4
em-oop/src/Greeting.java
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
public interface Greeting {
|
||||
String hello();
|
||||
}
|
||||
9
em-oop/src/JapaneseGreeting.java
Normal file
9
em-oop/src/JapaneseGreeting.java
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
public class JapaneseGreeting implements Greeting {
|
||||
@Override
|
||||
public String hello() {
|
||||
String str =("こんにちは");
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
public class Shape {
|
||||
public abstract class Shape {
|
||||
private String name;
|
||||
|
||||
public Shape (String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public double area() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public abstract double area() ;
|
||||
|
||||
public void showInfo() {
|
||||
System.out.println(this.name + "の面積は" +this.area() + "です");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user