Skip to content

Project: Digital clock

Rohidasgari edited this page Oct 15, 2026 · 2 revisions

Digital Clock

Project: Object-Oriented Programming
Language: Java
Concepts: Classes, objects, methods

About the Project

In this project, I worked on creating a digital clock using Java. The clock displays the time in hours, minutes and seconds, using the 24-hour format.

The program consists of two classes: NumberDisplay and ClockDisplay. The NumberDisplay class handles individual time values and makes sure they stay within the correct limits. The ClockDisplay class combines the hours, minutes and seconds to display the full time.

What I Worked On

  • Created classes to represent the different parts of a digital clock.
  • Used methods to update and display the time.
  • Implemented a counter that automatically resets when it reaches its limit.
  • Made the clock update the seconds, minutes and hours correctly.

What I Learned

I gained a better understanding of object-oriented programming in Java and how multiple classes can work together. I also learned how to use constructors, private variables, methods and conditional statements to manage the clock's functionality.

This project helped me understand how to structure a Java program and how smaller components can be combined to create a working application.

Code

Main.java ClockDisplay.java NumberDisplay.java

Clone this wiki locally