I have a question regarding “Interfaces” in Java, and the question is:
What is the use of an empty (empty) interface in my class?
To better understand the question, I will give you a specific example:
If you move on to implementing the ArrayList class, you will find that it implements two interfaces (RandomAccess and Cloneable) that are actually completely empty!
Why is this happening? What will I gain by implementing a completely empty interface for my class?
If you have any ideas, leave a comment.
Thanks in advance.
java oop interface
Origigr7
source share