This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If you want to chain methods, then they can't be "void" - in other words, return nothing. They should return the result of the previous calculation - what in the code is stored in "z".
There's no point really in using an interface here. You could use one if all the individual operations (plus, minus, multiply, ...) each had their own class; but that would be a contrived use. [ December 13, 2008: Message edited by: Ulf Dittmer ]
Martin Arun Paul Perumala
Joined: Dec 10, 2008
so can we change the return type (void) of the methods in the interface class to something else like object type.?