표준입력 (stdin)
실행옵션 (runtime option)
코드:
실행 »
표준입력/실행옵션
import java.time.*; import java.time.temporal.ChronoField; public class prog { public static void main(String[] args){ LocalTime present = LocalTime.now(); String ampm; if (present.get(ChronoField.AMPM_OF_DAY) == 0) { ampm = "오전"; } else { ampm = "오후"; } System.out.println("지금은 " + ampm + " " + present.get(ChronoField.HOUR_OF_AMPM) + "시입니다."); } }