A common practice in this case is to write both an interface and an abstract class.
The interface defines the contract of the polygon, while the abstract class contains the default implementation - which can include attributes like an array of vertices, and any methods you want to have default implementation for.
So you will have something like:
public interface Polygon { ... }
And in another file
public abstract class BasePolygonImpl implements Polygon {
protected Vertex[] vertices;
// ...
}
The reason for this is that if a person wants to create a Polygon which is implemented in a different way (for example, has a linked list of vertices or keeps its vertices in a database), they can create a class that implements Polygon and ignores the BasePolygonImpl class.
But if they want to implement a polygon which extends rather than replaces the default implementation, they can decide to use BasePolygonImpl as their superclass, and so to avoid repeating the base implementation.
The important point to notice is that interfaces do not define implementation, thus cannot include fields other than constants. Only classes can define implementation.
abstract classthan aninterface.