Reputation: 63
why classes in some java programs are implements an empty interface in java?
What is the usage?
interface E{
}
public class A implements E{
public static void main(String[] args) {
System.out.println("Something...");
}
}
Upvotes: 0
Views: 64
Reputation: 377
Also known as a Marker Interface:
http://en.wikipedia.org/wiki/Marker_interface_pattern
Upvotes: 0
Reputation: 34
Basically it is used to logically divide the code and a good way to categorize code. It is more useful for developing API and in frameworks like Spring.
Upvotes: 1