Solved

annotations and marker interfaces

Posted on 2014-03-25
3
218 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 38
jsp login check 12 42
Which non-HTML GUI front end to use with Java? 3 24
Java syntax, or is it Selenium 6 30
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 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