Interface with no methods

Why do Java introduces some interface which has no methods defined in it?

This are called Tagged or Marker interface. These are not used for any use or operation. These methods are used to tag or marking a class. So that you can determine whether someclass is a child of those classes.

about the second question

If you look closely you can see the declaration is

 private static native void registerNatives();

So registerNatives is a native methods.

So what is native methods. If you see this so question

The method is implemented in "native" code. That is, code that does not run in the JVM. It's typically written in C or C++.

Native methods are usually used to interface with system calls or libraries written in other programming languages.

So these methods are loaded from native codes. So you don't need to declare the body of the methods but still they are not abstract as they have their implementation from native codes.


Marker interface is used as a tag to inform a message to the java compiler so that it can add special behavior to the class implementing it. Java marker interface has no members in it.

The purpose of Marker interfaces is to force some kind of functionality in the classes by providing some functionality to a class if it implements the marker interface.

Read Java Marker Interface also see What is the use of marker interfaces in Java?