A simple, command-line digital clock application written in Java. This project demonstrates the fundamentals of multithreading by using separate threads for updating and displaying the current time concurrently.
- Displays the current time and date, updated every second.
- Utilizes a separate thread for background time updates and another for console display.
- Implements thread priorities to ensure the display thread is responsive.
- Uses the
volatilekeyword for thread-safe communication between threads. - Provides a clean, single-line output that overwrites itself, creating a dynamic display.
- Java
- Java Time API (
java.time)
-
Clone the repository:
git clone https://github.com/Toothless5143/java-multithreaded-clock/ cd java-multithreaded-clock -
Navigate to the source directory:
cd src -
Compile the Java files:
javac SimpleClockApplication.java Clock.java
-
Run the application:
java SimpleClockApplication
The current time will be displayed in your console, updating every second. Press Ctrl + C to stop the application.