Ask Question
8 April, 17:39

Write the definition of a class Clock. The class has three instance variables: One of type int called hours, another of type boolean called isTicking, 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. 8 April, 17:55
    0
    Step-by-step explanation:

    The definition of class as per given information is written below;

    public class Clock

    {

    private int hours;

    private boolean isTicking;

    private Integer diff;

    }

    The constructor that takes the three variables and then set the values to the instance variables is;

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

    {

    this. hours = hours;

    this. isTicking = isTicking;

    this. diff = new Integer (diff);

    }
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 📙 Mathematics 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