If the object is myAC and the interface consists of turnOn and turnOff then there are only two things you can do with an existing object: call turnOn and call turnOff. The syntax to call a method of an object is a simple dot hierarchy .(). Because turnOn and turnOff don't take arguments, you can leave the list empty and replacing object with myAC and method with turnOn, you get this:
myAC.turnOn();
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>none deal w/ messages
You aren't up to a point where messages are meaningful, your instructor is just using weird terminology to confuse you.
Because the problem suggests that officeAC is a variable that already exists, you can simply do this:
officeAC = new AirConditioner();
officeAC.turnOn();
>P.S. I have 2 books
p.s. I don't know of any Java book that doesn't cover basic constructor usage.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>this.diff;
This doesn't do very much, maybe you should assign diff to it:
public Clock ( int hours, boolean isTicking, Integer diff )
{
this.hours = hours;
this.isTicking = isTicking;
this.diff = diff;
}
Though that might not be such a good idea because Integer is an object reference, and this.diff would then be a reference to the object that diff refers to. You might consider cloning diff and assigning it to this.diff:
public Clock ( int hours, boolean isTicking, Integer diff )
{
this.hours = hours;
this.isTicking = isTicking;
this.diff = diff.clone();
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Show us the class, I'm tired of playing this guessing game.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401