20631.
Write the definition of a class Clock . The class has no constructors and three instance variables . One is of type int called hours , initialized to 12 , another is of type boolean called isTicking , and the last one is of type  Integer called diff .
Answer
public class Clock
{
private int hours=12;
private boolean isTicking;
private Integer diff;
}

20632.
Write the definition of a class Clock . The class has no constructors and three instance variables . One is of type int called hours , initialized to 12 , another is of type boolean called isTicking , initialized to true , and the last one is of type Integer called diff , initialized to 5 .
Answer
public class Clock
{
private int hours = 12;
private boolean isTicking = true;
private Integer diff = 5;
}


No comments:

Post a Comment