JAVA/자바 코딩의 기술1 5장 문제 발생에 대비하기 5-1 빠른 실패 class CruiseControl { static final double SPEED_OF_LIGHT_KMH = 1079252850; static final double SPEED_LIMIT = SPEED_OF_LIGHT_KMH; private double targetSpeedKmh; void setTargetSpeedKmh(double speedKmh) { if (speedKmh < 0) { throw new IllegalArgumentException(); } else if (speedKmh SPEED_LIMIT) { throw new IllegalArgumentException(); } // 일반적인 경로 targetSpeedKmh = speedKmh; } }위의 코드 처럼 매개변.. 2023. 3. 6. 이전 1 다음