Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter01 : interface 본문

JAVA/chapter18_interface

chapter01 : interface

GAWON 2023. 5. 30. 09:23
package org.joonzis.ex;

interface Animal{
	void move();			// 자동으로 abstract public void move(); 로 처리된다.
	void eat(String food);
}
class Dog implements Animal{
	@Override
	public void move() {
		System.out.println("개가 달린다.");
	}
	@Override
	public void eat(String food) {
		System.out.println(food + "먹는다.");
	}
}
public class Ex01_Interface {
	public static void main(String[] args) {
	
		//Animal animal = new Animal();
		Animal animal = new Dog();
		animal.move();
		animal.eat("사료");
		
	}
}

'JAVA > chapter18_interface' 카테고리의 다른 글

Test . interface  (0) 2023.05.30
chapter03 : interface  (0) 2023.05.30
chapter02 : interface  (0) 2023.05.30