diff --git "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/AnimalSoundMain.java" "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/AnimalSoundMain.java" new file mode 100644 index 0000000..c3181b1 --- /dev/null +++ "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/AnimalSoundMain.java" @@ -0,0 +1,25 @@ +package poly.ex1; + +public class AnimalSoundMain { + public static void main(String[] args) { + Dog dog = new Dog(); + Cat cat = new Cat(); + Caw caw = new Caw(); + + System.out.println("동물 소리 테스트 시작"); + dog.sound(); + System.out.println("동물 소리 테스트 종료"); + + System.out.println("동물 소리 테스트 시작"); + cat.sound(); + System.out.println("동물 소리 테스트 종료"); + + soundCaw(caw); + } + + private static void soundCaw(Caw caw) { + System.out.println("동물 소리 테스트 시작"); + caw.sound(); + System.out.println("동물 소리 테스트 종료"); + } +} diff --git "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Cat.java" "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Cat.java" new file mode 100644 index 0000000..c49159c --- /dev/null +++ "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Cat.java" @@ -0,0 +1,7 @@ +package poly.ex1; + +public class Cat { + public void sound() { + System.out.println("냐옹"); + } +} diff --git "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Caw.java" "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Caw.java" new file mode 100644 index 0000000..39449c9 --- /dev/null +++ "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Caw.java" @@ -0,0 +1,7 @@ +package poly.ex1; + +public class Caw { + public void sound() { + System.out.println("음메"); + } +} diff --git "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Dog.java" "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Dog.java" new file mode 100644 index 0000000..1aa233e --- /dev/null +++ "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/ex1/Dog.java" @@ -0,0 +1,7 @@ +package poly.ex1; + +public class Dog { + public void sound() { + System.out.println("멍멍"); + } +} diff --git "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/overriding/OverridingMain.java" "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/overriding/OverridingMain.java" index f1117b2..bd5dce9 100644 --- "a/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/overriding/OverridingMain.java" +++ "b/\352\271\200\354\225\204\353\246\260/java-basic/src/poly/overriding/OverridingMain.java" @@ -19,6 +19,6 @@ public static void main(String[] args) { System.out.println("Parent -> Child"); System.out.println("value = " + poly.value); // 변수는 오버라이딩 X poly.method(); // 메서드는 오버라이딩 - // 오버라이딩 된 메서드는 항상 우선권을 가진다 + // 오버라이딩 된 메서드는 항상 우선권을 가진딩 } }