I read many links on Stack like this question and i decided to ask .
When i create a Abstract Shape Class in Java i think the Class must have a method to getArea()
I think there are two way .
public abstract class Shape
{
public abstract double getArea();
}
When i create extended class from Shape , I redefine getArea() in extended classes.
So can i create this hierarchy with using Interface
like this ?
public interface Contain
{
public double getArea();
}
and create class like this :
public abstract class Shape implements Contain
{
...
}
Then redefine getArea() for extended class of Shape.
I am confused a little bit in there.
What is the best way to decide between Interface and Abstract Method in usage ?