How does marker interface provides functionality to the
implemented class ?
or How dose maker interface gets the functionalities as
serialization or cloning.
Answers were Sorted based on User's Feedback
Answer / somasundar m
Marker interface is a an interface which doesnot have any
variables and methods. Since it is following the design
pattern called Marker Design Pattern its is called as
Marker interface. This marker interface just tells the
compiler that all the marked classes with certain interface
names should be treated differently. It is used just to
mark the selected classes to do a certain functionality.
Example Serializable, Clonnable, etc. Here Serializable is
a marker interface just compiler to indentify which are the
classes should be marked for serialization. Now it can be
replace with annotations.
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / yadav
I answered , Nobody has clear answer regarding this, The
marker interfaces would have got the functionalities from
the super class or interface . Marker interfaces are
called as tagged interfaces which wraps a specific
functionality with its name.It doesn't contains any method.
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / qim2010
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 ? | 0 Yes | 0 No |
Answer / 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 |
How java is platform independent?
41 Answers College School Exams Tests, Infosys, TCS,
what is the purpose of the runtime class?
Write a function for palindrome and factorial and explain?
0 Answers Honeywell, Huawei, Zomato,
When should I use stringbuffer?
What is the difference between integer parseint and integer valueof?
how to write a server program and sending the mails to the server using smtp protocol please help me
what are the diffrences between interface and abstract class?
what r advatages of websphere? & how to deploy?
What will be the output of the program? public class Test { public static void main(String args[]) { ArrayList<String> list = new ArrayList<String>(); list.add("2"); list.add("3"); list.add("4"); list.add("5"); System.out.println("size :"+list.size()); for(int i=0;i<list.size();i++) { list.remove(i); } System.out.println("size after:"+list.size()); } }
Can we have more than one package statement in the source file?
What is thread start?
What is split return?