wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Use of Marker Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Use of Marker Interface" Watch "Use of Marker Interface" New topic
Author

Use of Marker Interface

Karthikeyan Ramaswamy
Ranch Hand

Joined: Apr 30, 2008
Posts: 41
hi all,

what is the use of Marker interface(interface have no methods).

example,

java.io.Serializable

above interface has no methods to implement.
so, my question is what is purpose for and how it's working.
and when we can write user-defined marker interface.
b panigrahy
Greenhorn

Joined: Apr 11, 2006
Posts: 14
Marker interface is meant for Reference type checking

Ex. if class A implements java.io.Serializable then when you transfer object of class A using ObjectOutputStream class then it will check inside writeObject(Object obj, boolean unshared) method.

Code snippet is :
if (obj instanceof Serializable) {
writeOrdinaryObject(obj, desc, unshared);
}else {
...
}

Marker is a logical term .
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

It also provides functionality without the developer having to code for the same.

Cheers,
Raj.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Karthikeyan R",
Please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of Marker Interface
 
Similar Threads
What is the need for marker interface ?
What is advantage of marker interface?
Marker Interface
Marker Interface
Marker interface