[Java] 상수 인터페이스(Constant Interface)사용에 대한 고찰
coco3o
Constant Interface Constant Interface란 오직 상수만 정의한 인터페이스이다. interface는 변수를 등록할 때 자동으로 public static final 키워드가 붙는다. 따라서 상수처럼 어디에서나 접근할 수 있으며, 하나의 클래스에서 여러 개의 interface를 implements 할 수 있는데, Constant Interface를 Implements 할 경우 인터페이스의 클래스 명을 네임스페이스로 붙이지 않고 바로 사용할 수 있다. 이러한 편리성 때문에 상수 인터페이스를 사용한다. public interface Constants { double PI = 3.14159; double PLANCK_CONSTANT = 6.62606896e-34; } public clas..