A class named Clock has two instance variables : hours (type int ) and isTicking (type boolean ). Write a constructor that takes a reference to an existing Clock object as a parameter and copies that object ‘s instance variables to the object being created.

LANGUAGE: JAVA

CHALLENGE:

A class named Clock has two instance variables : hours (type int ) and isTicking (type boolean ). Write a constructor that takes a reference to an existing Clock object as a parameter and copies that object ‘s instance variables to the object being created.

Your task: Write a Clock constructor that makes this possible. Just write this constructor — don’t write the whole class or any code outside of the class !

SOLUTION:

The Bad News: The content you are trying to access is only available to members.

The Good News: You too can be a member, simply Click Here.

Already a member?

Posted in ,