Get your CodeRanch badge!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regarding Marker Interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regarding Marker Interface?" Watch "Regarding Marker Interface?" New topic
Author

Regarding Marker Interface?

V. Potluri
Ranch Hand

Joined: Mar 29, 2007
Posts: 36
Hi,

As I know that market interface doesn't contain any methods or variables.
But JVM provides extra capability to the class that implements marker interface. For example, we can create clone of an object if it's class implements Clonable interface. Otherwise we cannot create clone of an object. Violating above rule raises runtime exception called CloneNotSupportedException.

Can we call Comparator interface as an marker interface eventhough it is having abstract method called compare. The signature of comapare in Comparator interface is as follows:



1. Can we call Comparator interface as marker interface?
2. Is any interface in java ,with methods called as marker interface?

Waiting for reply. Thanks in advance!

Have a wonderful day ahead!

Regards,
Gopal
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39552
    
  27
But JVM provides extra capability to the class that implements marker interface.

Let's be precise: some code somewhere provides the extra functionality. Often it's in the class libraries -not the JVM- (like for Serializable and Cloneable), but if you were to define a marker interface, then your code would have to implement its special functionality.

Can we call Comparator interface as marker interface?

Is any interface in java ,with methods called as marker interface?

No and no. Why would they? Marker interfaces are specifically those without methods.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Marker Interface?
 
Similar Threads
Shallow Copy implementation Question
comparator and comparable interfaces
Order a collection by date
How to Clone an Object??
Marker Interface