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 .
help me some one :(
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 .
help me some one :(
Hi everyone,
public class clock
{
public clock(int num)
{
}
}
Richard West
You need to give out more details. Do you wish learn how to write constructors in general or are having a particular problem with you Clock class?
Constructor for you Clock class would look something like the following code:
public Clock(int h)
{
this.hours = h;
}
thanks! it's been lot of help..
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.