Solved

annotations and marker interfaces

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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now