java oop : interface

This commit is contained in:
haerong22
2021-03-12 14:04:12 +09:00
parent 1c6e52efee
commit 9b81e125fb
8 changed files with 119 additions and 0 deletions

19
JavaOOP/src/Java23.java Normal file
View File

@@ -0,0 +1,19 @@
import poly.Animal;
import poly.Cat;
import poly.Dog;
public class Java23 {
public static void main(String[] args) {
// 추상클래스
// Animal animal = new Animal; (X)
// upcasting 으로 활용
Animal cat = new Cat();
Animal dog = new Dog();
cat.eat();
cat.move();
dog.eat();
dog.move();
}
}