> Can anyone explain the exact need of marker interface?
See reply #4.
..or is there something which you still don't understand? It's very very rare unusual that you create a marker interface so you don't have to think too much about them, and you will probably know when you need one.
Kaj
to serialize, classes have to implement Serializable market interface. only serializable objects can be queued (jms), so in a method that takes an argument to be queued, you can specify the parameter to be of a Serializable object rather than the class name itself. Then this method can be used to enqueue any object thus marked to a jms queue.
Here's an example I'm using:
I've got a program which displays lots of tables, it doesn't just display them, it prints them and it dumps them to Excell files.
Many of these tables have a total row at the bottom which needs highlighting. I flag the TableModel with a marker interface of my own. Then the various ways that table data is handled, when passed the TableModel, know to use a modifled JTable, or to use special formating flags on the last row.