I am unable to compile the below code written, Java always throws an error. Can you please help me out (P.S: I am new to Java, in a learning stage still). If anywhere, i hav
Well as the error says - certain classes that implement the calci
interface do not implement all the methods of that interface. When you are creating a class that implements an interface you need to implement all the methods from that interface, not only certain ones you are interested in. That's the whole point of interfaces. Otherwise you wouldn't be able to code against interfaces as for instance calci test = getCalciInstance().XXX()
where XXX()
is a method declared in calci
might not be implemented depending on which implementation's instance getCalciInstance()
would return!
So all your classes need to implement the following methods:
void add();
void sub();
void mul();
void div();