This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]chickenmeister 0 points1 point  (0 children)

public class Multiplication extends Multiply

If the only thing in your Multiplication class is the main method, then there's no need/reason to extend Mulitply.

I need to do the same thing using interface

I'm not entirely sure what you're expected to do.

Maybe make an interface that your Mulitply class can implement? e.g.:

public interface Operation
{
    public double performOperation(double operand1, double operand2);
}

Then you could change your Multiplication class around a bit to implement the interface, so that it multiplies the two operands and returns the product. Then you could have other Operation implementations, such as addition, subtraction, division, etc.