Purpose of Interface with no method/constant definition
java
Solution
There are a number of "marker" interfaces in the JDK already. This just signify something which doesn't need methods.
The most common example is Serializable which signifies the class can be serialized. The library does the rest so no additional methods are required.
An obscure one is RandomAccess which signifies than a List can be accessed randomly in an efficient manner. The Collections.sort() uses it.
Another class is Cloneable which is a marker interface but probably should have had a method
public Object clone();
Since Java 5.0, a better way to add meta information like this is to use Annotations, but these were not available previously.
Here is Jon Skeet's excellent answer to a similar question marker interface in java
Problem
I am a newbie to Java. I was able to compile the following interface without any errors. File Name : `empty_interface.java` File content : ``` public interface empty_interface {} ``` Questions a) Interface , i believe, is a contract which the implementor has to implement. What would a implementor will implement if it extends the above interface ? b) Might be related to a)...but here I go...Why would compiler allow a undefined interface to compile successfully ?