인터페이스
인터페이스
- 생성자가 없다 (단독 객체 생성 불가, new (interface명)이 불가능)
- 구현된 메소드는 가질수 없다 ( 추상 메소드만 가능 )
- 필드는 static final 상수만 가질수 있다.
- data type의 역할을 할수 있다.
- interface type 의 참조값이 필요하다면 구현(implments) 클래스를 이용해서 객체 생성을 해야한다.
- 클래스는 단일 상속(extends)이지만 인터페이스는 다중 구현(implements) 가 가능하다.
extends와 달리 다중 구현이 가능
Interface vs Abstract class
abstract : 구현 메소드를 보여주고 싶다, extends
interface : 틀만 보여주고 싶다 , implements