• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Marker interfaces

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi to all..
can any one define what are marker interfaces with a real time example...
i had studied some where that interface with blank body are called marker interfaces..
but Runnable interface contains one abstract method even though it is called a marker interface
in Remote interface they are no methods declarations...in the same way Serializable interface also doesn't contain any methods.. but how when we implement them our class object gets some special behavior?
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
marker interface doesnt implement methods. Basically marker interface is used to add a new property to the object, like serializable.
so when you implement these interface then that specific property is set for all objects for that class and the behaviour is same for all objects and cannot be change on demand basis.when JVM finds the marker interface it knows what to do with that object and doesnt wait for any logic to be formed on it like in case of cloneable interface.
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic