Menu

Can we create an interface without any method?

Yes, we can create an interface without any method. The interface which doesn't have any method or field declaration is called Marker Interface.

Java has few maker interfaces to handling the special scenarios and let the compiler know to treat those classes in a special way. Below are the example of some marker interfaces.


No comments:

Post a Comment