You are given a class named Clock that has one int instance variable called hours. Write a constructor with no parameters for the class Clock. The constructor should set hours to 12.

1
You are given a class named Clock that has one int instance variable called hours. Write a constructor with no parameters for the class  Clock. The constructor should set hours to 12.

LANGUAGE: JAVA

CHALLENGE:

You are given a class named Clock that has one int instance variable called hours. Write a constructor with no parameters for the class Clock. The constructor should set hours to 12.

SOLUTION:

public Clock(){
   hours = 12;
}

One comment

Add comment