This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 10268

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: 1473

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