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.

Respuesta :

Answer:

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.