Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 10747

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

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
I agree. Here's the link:
subject: Null interfaces in Java
jQuery in Action, 3rd edition