Interfaces have many uses in Java. One is to introduce new data types. For instance, java.lang.String is an Object, but it is also a Serializable, a Comparable.
By the way, it is not necessary for an interface to contain some methods and/or static final constants. It may be empty! The example is Serializable, Cloneable. Such interfaces just introduce Data types, not any methods or final static constants.
Such a design is called the Marker Pattern.
By the way, it is not necessary for an interface to contain some methods and/or static final constants. It may be empty! The example is Serializable, Cloneable. Such interfaces just introduce Data types, not any methods or final static constants.
Such a design is called the Marker Pattern.