You are given a class named Clock that has one int instance variable called hours. Write a constructor for the class Clock that takes one parameter, an int, and gives its value to hours.

You are given a class named Clock that has one int  instance variable called hours. Write a constructor for the class  Clock that takes one parameter, an int, and gives its value to hours.

LANGUAGE: JAVA

CHALLENGE:

You are given a class named Clock that has one int instance variable called hours. Write a constructor for the class Clock that takes one parameter, an int, and gives its value to hours.

SOLUTION:


public Clock (int hours){
   this.hours = hours;
}

Add comment