What is Marker interface in java? and what is clone?
Answers were Sorted based on User's Feedback
Answer / unknown
marker interface is tagged interface with no methods inside
it.clone means copy of an object
Is This Answer Correct ? | 47 Yes | 12 No |
Answer / samir
Marker interface is interface which doesn't have nay method
but still holds information..
Ex: Clonable
Is This Answer Correct ? | 44 Yes | 12 No |
Answer / ajay tiwari
Marker interfaces are those interface which may contain any
method but they provide some special information to the JVM
about what type of class or object it can be.
EX. Cloneable is a marker interface with no method which
means but it provide information to the JVM that class's
object who implement it can be cloned.
Runnable is also a marker interface with a run() method
which provide the information to the JVM that class's
object which implement this is used as a thread.
while the collection interface doesn't provide any special
information to the JVM that's why it is not as a Marker
interface
Is This Answer Correct ? | 33 Yes | 7 No |
Answer / medha
marker interface is interface with no methods.marker
interfaces:
serializable,clonable,SingleThreadModel,EventListener
marker interfaces are called in order to add some
functionality to the calling classes.
Is This Answer Correct ? | 16 Yes | 2 No |
Answer / tamilvendan
Marker interface is nothing but it do not have any method
but it will hold the information
Is This Answer Correct ? | 16 Yes | 8 No |
1)By implementing for interface,our object can get some
ability such type interfaces called as "marker/ability/tag
interfaces".
Ex:
By implementing Serializable interface,our objects can able
to travel across network and can able to save the file
persistently.
2)If any interface does not contain any methods, it is
always called "marker interface".
Ex:
Serializable ,Clonable,RandomAccess,SingleThreadModel.
in these cases,JVM will provide required ability
automatically.
3)Even though interface contains methods by implementing
that interface if our objects will get some ability still we
can consider it as marker interface.
Ex:
Comparable [compareTo()method],Runnable[run() method] etc.
in these cases,required ability should be provided by
programmer.
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / muruga
Hi
This is Muruga
Runnable Interface is an Marker Interface but it having
run() method, it reason for JVM will collect the system
properties at run time. Thats why we are called Runnable
Interface is an Marker Interface.
Friends you have some points means pl send to me.
Thanks and all
Muruga
Is This Answer Correct ? | 20 Yes | 15 No |
Answer / alok kumar ranjan
Marker interface is tagged interface with no methods inside
it.clone means copy of an object.
The marker interfaces are used to provide certain
functionality to classes you code. Take for
instance the Cloneable interface. This interface is
implemented by the JVM itself and allows
copies of objects to be created without the developer having
to write code for this purpose.
User written marker interfaces can also be used for
inheritance purposes.Marker Interfaces are
used to mark the capability of a class as implementing a
specific interface at run-time.
Some examples of marker interfaces are :-
1) Serializable
2) Cloneable
3) RandomAccess
4) SingleThreadModel
5) EventListner
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / gaurav j
How can you serialize an object. The execution must be finished so that results can be serialized. But if execution is finished so will be data. Marking an object will tell jvm to hold data for specified operation and then mark it for garbage collection, just my thought. Please verify.
Is This Answer Correct ? | 0 Yes | 0 No |
Explain how can you debug the Java code?
What is a lock or purpose of locks in java?
What is meant by bytecode?
What is the benefit of abstract class?
What are the different ways to handle exceptions?
how many design pattern r there? and wht design pattern u use and why ?
Are registers volatile?
When do you get classcastexception?
What is the major difference between linkedlist and arraylist?
What is data string?
what are the differences between final,finally,finalize methods?
What is array initialization in java?