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.?