A simple Java console-based alarm clock built while following a programming course.
The project demonstrates basic usage of threads, time handling, and audio playback in Java.
- User inputs alarm time in format
HH:mm:ss - Live console clock display
- Waits until the selected time
- Plays a sound when the alarm triggers
- Stop alarm manually by typing
Q
- User enters a target alarm time
- Program parses it using
LocalTime - A separate thread runs and checks current time every second
- When time matches:
- WAV sound is played using Java Sound API
- User can stop playback by entering
Q
- Java SE
- Multithreading (
Runnable,Thread) java.timeAPI (LocalTime,DateTimeFormatter)- Java Sound API (
AudioSystem,Clip) - Console input/output (
Scanner)
javac Main.java AlarmClock.javajava Main