File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes what is the meaning of marker interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "what is the meaning of marker interface?" Watch "what is the meaning of marker interface?" New topic
Author

what is the meaning of marker interface?

Nagacharan Lokkidi
Greenhorn

Joined: Jul 25, 2011
Posts: 9
hi to all,
i knew something about marker interface i.e marker interface do not have the methods to override, but my friend said we can define our own methods. Which is the correct one my friends or me?
Please help me for this..
Thanks in advance.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8435

Marker interfaces by definition need to be empty. Else they are just like any other interface. Of course this does not mean you cannot define your own method signatures in the interface. Only that, then it wont be technically a marker interface.
More information can be found in this FAQ article http://www.coderanch.com/how-to/java/Java-FAQ#marker


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Nagacharan Lokkidi wrote:
but my friend said we can define our own methods. Which is the correct one my friends or me?

We can define, but again as maneesh said we cant call that as Marker interface!
Note:marker interface contains java.lang.Object's public methods implicitly, unless you declare explicitly!
from JLS:

If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method mm with signature ss, return type rr, and throws clause tt corresponding to each public instance method mm with signature ss, return type rr, and throws clause tt declared in Object, unless a method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.


<edit>for clarity</edit>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
Please avail yourself of the search facility of this site to find the many, many, threads where this subject has been asked and exhaustively answered before. There's no really no point in rehashing all that over and over and over again.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: what is the meaning of marker interface?
 
Similar Threads
What is advantage of marker interface?
Is Runnable a marker interface ?
Is an empty interface (without any methods) is marker?
Marker Interface
Marker InterFace...