The most common use of extending interfaces occurs when the parent interface does not contain any methods. For example, the MouseListener interface in the java.awt.event package extended java.util.EventListener, which is defined as:package java.util;public interface EventListener{}An interface with no methods in it is referred to as a tagging interface. There are two basic design purposes of tagging interfaces:Creates a common parent: As with the EventListener interface, which is extended by dozens of other interfaces in the Java API, you can use a tagging interface to create a common parent among a group of interfaces. For example, when an interface extends EventListener, the JVM knows that this particular interface is going to be used in an event delegation scenario.Adds a data type to a class: This situation is where the term tagging comes from. A class that implements a tagging interface does not need to define any methods (since the interface does not have any), but the class becomes an interface type through polymorphism.
Java
Topic: Abstract Class and Interfaces
Explain tagging interfaces in java?
Browse random answers:
How to Declare Interfaces in java?
what are the properties of interfaces?
How to implement interfaces?
How to extend intrfaces?
Explain tagging interfaces in java?
What is the difference between Abstract class and Interface?
What does it mean that a method or class is abstract?
What must a class do to implement an interface?
What is a cloneable interface and how many methods does it contain?
What is meant by "Abstract Interface"?
How to define an Interface?
Can Abstract Class have constructors? Can interfaces have constructors?
What methods would a class that implements the java.lang.CharSequence interface have to implement?
What is wrong with the following interface?public interface SomethingIsWrong { void aMethod(int aValue) { System.out.println("Hi Mom"); }}
Is the following interface valid?public interface Marker {}
Can interfaces contain inner classes?
What interface do you implement to do the sorting?
What is the eligibility for a object to get cloned?
What is the use of serializable?
Can a abstract method have the static qualifier?