Ask Question

Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hours, another is of type boolean called isTicking, and the last one is of type Integer called diff.

+3
Answers (1)
  1. 3 February, 05:51
    0
    public class Clock

    / / create the class

    {

    private int hours;

    / / variable declaration of hours

    private boolean isTicking;

    / / variable declaration of boolean

    private Integer diff;

    / / variable declaration of diff

    }

    Explanation:

    Following are the description of the above code

    Firstly create the class called To Create any class we use the keyword class followed by the class name. In the class, we declared three variable one type integer called " hours" The second is type boolean called "isTicking" and the last one is also integer called "diff". They all are three variables are private it means they are not accessible outside the class.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hours, another ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers