GeeCON Prague 2014*
The moose likes Java in General and the fly likes Conceptual difference between annotation and marker interface. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Conceptual difference between annotation and marker interface." Watch "Conceptual difference between annotation and marker interface." New topic
Author

Conceptual difference between annotation and marker interface.

Joseph Kulandai
Greenhorn

Joined: Sep 25, 2003
Posts: 3
Marker interface informs a compiler about a class. Sameway annotation is also gives information about class / method / object.

Then in what way they are different?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"JK"

Please check you private messages.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Marker interfaces have been a part of Java since the beginning, while annotations were only introduced with Java 5. Everything that can be done with marker interfaces can be done instead with annotations; and in fact, it's now recommended that the "marker interface pattern" not be used any longer. Annotations can have parameters of various kinds, so they're much more flexible.


[Jess in Action][AskingGoodQuestions]
 
GeeCON Prague 2014
 
subject: Conceptual difference between annotation and marker interface.