I received an error and I have this structure in my program
public interface Shapes{
//methods here
}
public class ShapeAction implements
Have you tried this?
public class Circle extends ShapeAction{
//Some methods here
}
There is no way the compiler can tell what the T
argument means in extends ShapeAction
unless you define it first.
Eventually, when you use a reference to a Circle
, you will have to provide a type argument for T
, which will be cascaded to all other appearances of this type.
Circle myInt;
Will cause the compiler to interpret the code as:
public class Circle extends ShapeAction{
//Some methods here
}
And so on, for the rest of the class hierarchy.
As such, if you do not define the type T
in the class Circle
. There wouldn't be a way for the compiler to tell the parameterized type of ShapeAction
and this is most likely the source of the problem here.