Solved

annotations and marker interfaces

Posted on 2014-03-25
3
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven module vs maven project 3 116
Is Applet the way to go for my drag and drop system? 8 51
java example issue 5 67
JVM error from eclipse 1 27
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

751 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