This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Regarding Marker Interface?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic