Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How does marker interface provides functionality to the
implemented class ?

or How dose maker interface gets the functionalities as
serialization or cloning.

Answer Posted / laxman

In java language programming, interfaces with no methods are
known as marker interfaces. Marker interfaces are
Serializable, Clonable, SingleThreadModel, Event listener.
Marker Interfaces are implemented by the classes or their
super classes in order to add some functionality.

e.g. Suppose you want to persist (save) the state of an
object then you have to implement the Serializable interface
otherwise the compiler will throw an error. To make more
clearly understand the concept of marker interface you
should go through one more example.

Suppose the interface Clonable is neither implemented by a
class named Myclass nor it's any super class, then a call to
the method clone() on Myclass's object will give an error.
This means, to add this functionality one should implement
the Clonable interface. While the Clonable is an empty
interface but it provides an important functionality.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why arraylist is not synchronized in java example?

970


If you do not want your class to be inherited by any other class. What would you do?

943


Explain the difference between extends thread vs implements runnable in java?

1059


Is java same as core java?

1036


How is hashset defined in java?

962


How finally used under exception handling?

896


What is temp in java?

942


What does string [] args mean?

953


What is 32 bit float?

925


What are the drawbacks of reflection?

957


What is the difference between yielding and sleeping?

1030


can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread

931


What is an 8 bit word?

1001


What is a container in a gui?

932


When does an object becomes eligible for garbage collection in java?

1005