What is marker interface

Questions by sunmyid

Showing Answers 1 - 5 of 5 Answers

azhagu

  • Nov 3rd, 2005
 

It is an interface which does not have any method with in it.

It is used to check that whether the instance belongs to that class

  Was this answer useful?  Yes

Buddhadev Dasgupta

  • Jan 19th, 2006
 

Marker interface are also know as tag interface.

Marker interface don't have any method,

this interface are used as tag only.

for example suppose we have some product from different country , and every product has some discount on it depending upon , which countries product it is ,

now here we can implement the marker interface, let say we have two marker interface India and Usa,

and this interface don't have any method.

and every Indian product have to impliment India interface and every USA product shoiuld impliment Usa interface.

no the next question is how can we now know a particuler product belogs to which country.

we can use isInstanceOf method to know the product is belogs to which country.

  Was this answer useful?  Yes

An interface does not contain any methods and giving the chance to programres for creating of their own logic in their own methods.
Examples:
java.io.Serializable
java.lang.Cronable
java.rmi.Remote

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions