It depends. But this is not such a bad idea.
In C and in many versions of Pascal, separating an interface from an implementation is a common practice. This helps the compiler avoid unnecessarily recompiling modules when the implementation on which they depend changes.
In Java, the compiler is usually not a concern. Java provides public, secure, private, and private (implicit) access classes that limit how much other classes may depend on the details of a particular class. Javadoc provides (by default) documentation that omits unnecessary and unnecessary details. We also have the widespread YAGNI principle: if "you don't need it," don't develop it.
Nevertheless, using an explicit interface in Java, rather than using an implementation directly, provides an additional opportunity to clearly understand what structure and behavior users of a certain class should influence. The ability to implement multiple interfaces means that users of a particular class can even determine the dependence on one or more specific aspects of the implementation, such as its Serializable nature.
source share