Java - Interface
interface 인터페이스명 { //상수 타입 상수명 = 값; //추상메서드 타입 메소드명(매개변수,...); //디폴트메서드 default 타입 메소드명(매개변수,...) {...} //정적 메소드 static 타입 메소드명(매개변수) {...} }public interface RemoteControl { public static final int MAX_VOLUME = 10; public static final int MIN_VOLUME = 0; }
public interface RemoteControl { public abstract void turnOn(); public abstract void turnOff(); public abstract void setVolume(int volume); }
public interface RemoteControl { public default void setMute(boolean mute){ if(mute) {...} else {...} } }
public interface RemoteControl { public static void changeBattery(){ //... } }


Last updated