Create a class called Time with three attributes hours, minutes, and seconds. Use appropriate constructor(s) to initialize instance variables. Also, use a display method to display the time in hh:mm:ss format. Modify the class to add two time objects that correctly results in addition of times.


Updated: Nov. 27, 2020 — Training Time: 2 minutes
Overseen by: Archangel Macsika

Topic:Generic - Java Programming

Difficulty: Advance.

Companies who previously asked this: -.

Objective: Create a class called Time with three attributes hours, minutes, and seconds. Use appropriate constructor(s) to initialize instance variables. Also, use a display method to display the time in hh:mm:ss format. Modify the class to add two time objects that correctly results in addition of times.

Input: Numbers to serve as time values.

Expected Output: Result will vary based on the user input.

Sikademy Solution

Was this training resource helpful?