Ask Question
24 April, 20:03

Write the definition of a class Clock. The class has three instance variables: One of type int called hours, another of type boolean called is Ticking, and the last one of type Integer called diff. You should also write a constructor that takes three parameters - - an int, a boolean, and another int. The constructor should set the instance variables to the values provided.

+5
Answers (1)
  1. 24 April, 22:53
    0
    Following is the definition of class Clock:

    public Clock (int hours, boolean isTicking, int diff)

    {

    this. hours = hours;

    this. isTicking = isTicking;

    this. diff = new Integer (diff);

    }

    Explanation:

    A public class Clock has three parameters namely hours (data type: int), isTicking (data type: boolean), diff (data type: int). The class Clock contains a constructor having three parameters that are hours in int isTicking in boolean diff in integer
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the definition of a class Clock. The class has three instance variables: One of type int called hours, another of type boolean called ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers