marker annotations over marker interfaces

The chief advantage of marker annotations over marker interfaces is that it is
possible to add more information to an annotation type after it is already in use, by
adding one or more annotation type elements with defaults

I was reading above staemtent. I have not understood the statement, concept behind clearly.
Please advise. Any ideas, sugestions, sample code, links, resources highly appreciated. thanks in advance
Who is Participating?
Modifying interfaces is generally not a good idea. They are strict contracts and changing them can impact on code across your application. eg. adding a new method to an interface would require all classes that mplement the interface to provide an implementation of that method.

Annotations on the other hand are more flexible, and you can add extra annotations without impacting on other areas of the code.
gudii9Author Commented:
so we can add new method to same interface with new annotation right without changing the code in parent interface, child classes right.please advise
you cannot easily change interfaces as it results in changes being required in other classes.
on the other hand you can add new annotations far more easily
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.