Solved

annotations and marker interfaces

Posted on 2014-03-25
3
224 Views
Last Modified: 2014-04-29
You cannot force your subclasses to unimplement an interface. Annotations can have parameters of various kinds, and they are much more flexible than the marker interfaces.

I am reading as above. I have not understood clearly .

Are marker interfaces not  needed if annotations there. ?
please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39954846
Basically, yes, marker interfaces are the old way of identifying a class with some extra metadata, eg. the Serializable interface is just a marker interface that, when a class "implements" that interface, marks that class as able to be serialized.

Annotations are the new way of providing this metadata. If Java was totally redesigned removing all the backwards compataible stuff, then Serializable would be an annotation that you could annotate your class with. It also states that annotations are more flexible, because in addition to just marking a class with just one piece of metadata, with annotations you are able to provide all sorts of metadata with the annotation. As just one made up example, if Serializable was done as an annotation, you could also include in the annotation the name of another class that should be used to actually perform the serialization. Also, annotations are more flexible because they can be applied to more than just classes; you can annotate methods,fields,variables,parameters,packages,etc
0
 
LVL 7

Author Comment

by:gudii9
ID: 40007009
If Java was totally redesigned removing all the backwards compataible stuff, then Serializable would be an annotation that you could annotate your class with.

Is this could be future enhancement in java which is is not existing now(make Serializeble as annotation)

please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 40020411
please advise
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question