- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of marker interfaces in Java?
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.
- Related Articles
- What is marker or tagged interfaces in Java
- What is the purpose of interfaces in java?
- Why do we use interfaces in Java?
- What is a marker or tagged interface in Java?
- What are the SAM Interfaces in Java?
- What are nested interfaces in Java?
- What is the difference between Externalizable and Serializable interfaces in Java?
- What is the difference between interfaces and abstract classes in Java?
- Evolution of interfaces in Java
- What are the in-built functional interfaces in Java?
- Interfaces in Java
- Marker interface in Java
- What are the core interfaces of Reactive Streams in Java 9?
- How can we use lambda expressions with functional interfaces in Java?
- How to use Consumer and BiConsumer interfaces in lambda expression in Java?

Advertisements