File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Can I make an Interface as marker Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Can I make an Interface as marker Interface " Watch "Can I make an Interface as marker Interface " New topic
Author

Can I make an Interface as marker Interface

Waez Ali
Greenhorn

Joined: Jan 10, 2005
Posts: 22
Hi,

I just want to know can i create my own marker interface(that doesn't contain any thing) for my class.
As Cloneable,Serializable are...

So Please Let me know.

Thanks.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24056
    
  13

Of course.

Now, you also have to write any code which imparts meaning to that marker interface. Java itself won't know or care anything about it.


[Jess in Action][AskingGoodQuestions]
Waez Ali
Greenhorn

Joined: Jan 10, 2005
Posts: 22
Hi Ernest,

Can You Please provide me sample Code.

Waiting For sample Code...
Thanks.
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
If you know how to define an interface, you know how to define a marker interface. Take any of the interfaces you've created and remove all method and constant declarations. Bingo, marker interface. Then use instanceof to test if an object implements your marker interface.
Waez Ali
Greenhorn

Joined: Jan 10, 2005
Posts: 22
Hi David,
I was waiting for your reply,
I got it now how to make marker Interface.

Thanks...
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Can I make an Interface as marker Interface
 
Similar Threads
marker interface
Marker Interface
Marker interface related question
Marker Interface
marker interface