diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb0e6a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/* +*.class \ No newline at end of file diff --git a/bin/Urashima.class b/bin/Urashima.class index 458c7e8..6a5a076 100644 --- a/bin/Urashima.class +++ b/bin/Urashima.class Binary files differ diff --git a/src/Actor.java b/src/Actor.java new file mode 100644 index 0000000..bfc5ee1 --- /dev/null +++ b/src/Actor.java @@ -0,0 +1,25 @@ +public class Actor { + String name = ""; + + void showName() { + System.out.println(name); + } + + void getItem(Item item) { + System.out.println(name + " は " + item.to_string() + " を手に入れた。"); + } + + void giveItem(Item item, Actor name) { + System.out.println(this.name + " は " + item.to_string() + " を " + name.to_string() + " に渡した。"); + } + + String to_string(){ + return name; + } +} + +class Urashima extends Actor { + Urashima(){ + name = "浦島太郎"; + } +} \ No newline at end of file diff --git a/src/Item.java b/src/Item.java new file mode 100644 index 0000000..0720cf1 --- /dev/null +++ b/src/Item.java @@ -0,0 +1,21 @@ +public class Item { + String name = ""; + + public Item(String string) { + } + + void setMono(String name) { + this.name = name; + } + + public String to_string() { + return name; + } + +} + +class Tamatebako extends Item { + Tamatebako() { + super("玉手箱"); + } +} diff --git a/src/Urashima.java b/src/Urashima.java index 0e8ed8c..a6d338d 100644 --- a/src/Urashima.java +++ b/src/Urashima.java @@ -1,6 +1,10 @@ public class Urashima { public static void main(String[] args) throws Exception { System.out.println("Hello, World!"); - + + // + Urashima urashima = new Urashima(); + Tamatebako tamatebako = new Tamatebako(); + urashima.getItem(tamatebako); } }