This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marker Interface

 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends ,
I am back here with my queries to be resolved by you.
Well i dont understand what is the significance of marker interface when there are no methos declaration in that ?
Could anyone highlight me the importance of marker interfaces ??
I hope you would resolve my query.This was one of the questions in the interview ..
Thanks,
Saurabh
 
Chandra Bairi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the very good questions asked. Marker interface does not have any methods. This is true. the basic thing is that when we implement a marker interface the java compiler notes that it has implemented a certain interface and it will try to assign some properties to the class that implemented it. Like if SingleThreadModel interface is implemented then there may be some variables which will get attached to the class and whenever the objects of these classes are accessed the variables which exist in the marker interface may come into picture. these will help in keeping the object accessed by the users one at a time as SingleThread model does. kindly correct if I am wrong.
regards,
shekar.
 
mady sady
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marker interface is used by JVM to check instance. We can also create marker interface. Most of the time in interview it is asked.

For example : Serializable This is an interface which is compulsion to implement for serialization and it is checked during file read right.

For more details you can refer:
www.classiccoder.com
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Madhu, welcome to JavaRanch.

Please note that you are responding to a topic from 2004 - more than six years ago! The original poster is most likely not still waiting for an answer.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
madhu sahu wrote:... For more details you can refer: www.classiccoder.com

So you ask a question elsewhere, then you answer it yourself, and now you link to it from here? What is that all about (ignoring the annoying color of your post for the moment)?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
madhu sahu wrote:... For more details you can refer: www.classiccoder.com

So you ask a question elsewhere, then you answer it yourself, and now you link to it from here? What is that all about (ignoring the annoying color of your post for the moment)?


Maybe he is the owner of the classiccoder site! =P
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:Maybe he is the owner of the classiccoder site! =P


No joke... he's apparently the only one who ever posts there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic