인터페이스

· Java
인터페이스의 기능 구현 강제Java의 인터페이스는 모든 메서드가 추상 메서드로 존재한다. 그래서 구현체인 클래스에게 인터페이스의 메서드들을 구현하도록 강제한다. 인터페이스를 구현한 클래스가 있는데 인터페이스에서 명시되어 있는 메서드를 구현하지 않은 채로 냅두면 컴파일 에러가 뜬다. 다형성 제공public interface MyRunnable { void myRun(); } public interface YourRunnable { void yourRun(); } public class MyClass implements MyRunnable, YourRunnable { @Override public void myRun() { System.out.println("my run"); } @Override publi..
인재이
'인터페이스' 태그의 글 목록