• Post Reply Bookmark Topic Watch Topic
  • New Topic

Marker interface  RSS feed

 
Omkant Parashetty
Greenhorn
Posts: 4
Java Java ME Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a doubt in marker interface.These interfaces are not having any methods or any attributes.
Then how it works internally.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Internally to what?

Marker interfaces were used to "mark" a class so that it could be tested for implementing the interface. No methods are defined because the interface isn't representing any behavior; rather, they're kind of a meta-typing boolean value: does it implement or not?

These days, annotations have pretty much taken over much of that mantle.
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way you would write code to determine whether an object implements a marker interface (or any other interface for that matter) is like this:



So that's presumably how it's done in code which is part of the standard Java API as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!