What is Marker interface in java? and what is clone?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is serial version uid and its importance in java?

602


Explain about interthread communication and how it takes place in java?

548


Detail discussions on JVM, memory management and garbage collector.

560


Can a constructor be private and how are this() and super() method used with constructor?

531


What is use of functional interface in java 8? Explain

567






Can we override constructor?

543


When do we use synchronized blocks and advantages of using synchronized blocks?

669


What is an infinite loop?

550


What is the use of predicate in java 8?

496


Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.

524


Why is method overloading not possible by changing the return type in java?

597


Explain the importance of finally block in java?

570


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

609


Can a static class have a constructor java?

554


What is the difference between the file and randomaccessfile classes?

537