This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Java in General and the fly likes Null interfaces in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Null interfaces in Java" Watch "Null interfaces in Java" New topic

Null interfaces in Java

deepika bhatia

Joined: Jun 26, 2009
Posts: 10
does anyone know what are null interfaces in java and what is its significance
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10733

Null interface is another name for marker interface. (I personally prefer marker)

Such an interface is empty, i.e. without any method declarations. Serializable interface is a classic example.
When any object implements Serializable, the JVM knows that it is supposed to treat it in a special way.

Google() for more information. This is a much discussed topic.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Swastik Dey

Joined: Jan 08, 2009
Posts: 1508

null interface is an interface that does not contain any method but is used to perform a special task. For e.g. Serializable interface, which does not have any method. But if we wish to serialize any class it must implement Serializable interface.

deepika bhatia

Joined: Jun 26, 2009
Posts: 10
maneesh and swastik thanks for replying
It is sorta covered in the JavaRanch Style Guide.
subject: Null interfaces in Java
It's not a secret anymore!