아이템22 인터페이스 타입을 정의하는 용도로만 사용하라
Effective Java 3e 아이템 22를 요약한 내용 입니다.
public interface PhysicalConstants {
// 아보가드로 수 (1/몰)
static final double AVOGADROS_NUMBER = 6.022_140_857e23;
// 볼츠만 상수 (J/K)
static final double BOLTZMANN_CONSTANT = 1.380_648)52e-23;
// 전자 질량 (kg)
static final double ELECTRON_MASS = 9.109_383_56e-31;
}public interface TestInterFace {
static String NAME = "incheol";
}
public class InterfaceImpl implements TestInterFace {
public static void main(String[] args) {
System.out.println(NAME);
}
}
// result : incheol
public class InterfaceImpl implements TestInterFace {
public static final String NAME = "test";
public static void main(String[] args) {
System.out.println(NAME);
}
}
// result : test정리
Last updated