diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..96ee3d1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/bin/Ikimono.class b/bin/Ikimono.class new file mode 100644 index 0000000..f26e92b --- /dev/null +++ b/bin/Ikimono.class Binary files differ diff --git a/bin/Inu.class b/bin/Inu.class new file mode 100644 index 0000000..bbfc6d5 --- /dev/null +++ b/bin/Inu.class Binary files differ diff --git a/bin/Kibidango.class b/bin/Kibidango.class new file mode 100644 index 0000000..c312229 --- /dev/null +++ b/bin/Kibidango.class Binary files differ diff --git a/bin/Momo.class b/bin/Momo.class new file mode 100644 index 0000000..010c6b7 --- /dev/null +++ b/bin/Momo.class Binary files differ diff --git a/bin/Momotaro.class b/bin/Momotaro.class new file mode 100644 index 0000000..5bf7c2a --- /dev/null +++ b/bin/Momotaro.class Binary files differ diff --git a/bin/Mono.class b/bin/Mono.class new file mode 100644 index 0000000..bd07a0a --- /dev/null +++ b/bin/Mono.class Binary files differ diff --git a/bin/MyApp.class b/bin/MyApp.class new file mode 100644 index 0000000..d192670 --- /dev/null +++ b/bin/MyApp.class Binary files differ diff --git a/bin/Obaasan.class b/bin/Obaasan.class new file mode 100644 index 0000000..701e24f --- /dev/null +++ b/bin/Obaasan.class Binary files differ diff --git a/bin/Ojiisan.class b/bin/Ojiisan.class new file mode 100644 index 0000000..b55994f --- /dev/null +++ b/bin/Ojiisan.class Binary files differ diff --git a/bin/Saru.class b/bin/Saru.class new file mode 100644 index 0000000..0a98188 --- /dev/null +++ b/bin/Saru.class Binary files differ diff --git a/bin/Tori.class b/bin/Tori.class new file mode 100644 index 0000000..7e0a547 --- /dev/null +++ b/bin/Tori.class Binary files differ diff --git a/src/Ikimono.java b/src/Ikimono.java new file mode 100644 index 0000000..8d6da9e --- /dev/null +++ b/src/Ikimono.java @@ -0,0 +1,63 @@ +import java.util.ArrayDeque; + +public class Ikimono { + String name = ""; + void printName(){ + System.out.println(name); + } + void morauKibi(Kibidango dango){ + System.out.println(name + "が "+dango.toString()+" をもらった"); + } +} + +class Momotaro extends Ikimono { + ArrayDeque kibiBukuro; + Momotaro(){ + name = "momotarou"; + } + + void morauFukuro(ArrayDeque f){ + kibiBukuro = f; + } + void watasuKibi(Ikimono dareka){ + Kibidango oneKibi = kibiBukuro.pop(); + dareka.morauKibi(oneKibi); + System.out.println("nokori "+kibiBukuro.size()); + } +} + +class Ojiisan extends Ikimono { + Ojiisan(){ + name = "ojiiisan"; + } + +} + +class Obaasan extends Ikimono { + Obaasan(){ + name = "obaasan"; + } + ArrayDeque giveKibidangos(){ + ArrayDeque fukuro = new ArrayDeque(); + fukuro.add(new Kibidango()); + fukuro.add(new Kibidango()); + fukuro.add(new Kibidango()); + + return fukuro; + } +} +class Inu extends Ikimono { + Inu(){ + name = "inu"; + } +} +class Saru extends Ikimono { + Saru(){ + name = "saru"; + } +} +class Tori extends Ikimono { + Tori(){ + name = "tori"; + } +} \ No newline at end of file diff --git a/src/Mono.java b/src/Mono.java new file mode 100644 index 0000000..c3d8fb4 --- /dev/null +++ b/src/Mono.java @@ -0,0 +1,26 @@ +public class Mono { + String name = ""; + + @Override + public String toString(){ + return name; + } +} + +class Momo extends Mono { + Momo(){ + name = "momo"; + } + Momotaro createMomotaro(){ + return new Momotaro(); + } + +} + +class Kibidango extends Mono { + Kibidango(){ + name = "kibidango"; + } + + +} \ No newline at end of file diff --git a/src/MyApp.java b/src/MyApp.java new file mode 100644 index 0000000..f5bb737 --- /dev/null +++ b/src/MyApp.java @@ -0,0 +1,23 @@ +public class MyApp { + public static void main(String[] args) throws Exception { + System.out.println("Hello, World!"); + + Ojiisan jisan = new Ojiisan(); + Obaasan baasan = new Obaasan(); + + Momo momo = new Momo(); + + Momotaro taro = momo.createMomotaro(); + + taro.morauFukuro(baasan.giveKibidangos()); + + Inu inu = new Inu(); + taro.watasuKibi(inu); + Saru saru = new Saru(); + taro.watasuKibi(saru); + Tori tori = new Tori(); + taro.watasuKibi(tori); + + + } +}