what is use of marker interface? give me good example?

Answers were Sorted based on User's Feedback



what is use of marker interface? give me good example?..

Answer / aravind

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.

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 ?    10 Yes 6 No

what is use of marker interface? give me good example?..

Answer / devendra.m

Marker interface is a interface,in which that,it doesn't
have any methods...just which is giving mark to the run time
environment.
clonable,serializable,singleThreadModel are marker interfaces.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is string substring?

0 Answers  


java is pure object-oriented programming language?why it is platform independent.

1 Answers  


Why webdriver is an interface?

0 Answers  


What is the public method modifier?

0 Answers  


what is the use of clone() in real time scenario?

2 Answers   Quinnox,






Is there any difference between synchronized methods and synchronized statements?

0 Answers  


How to perform bubble sort in java?

0 Answers  


Is it possible to write JAVA program without including any of the packages,such as "import java.io.*"; bcoz I instantly wrote a code without "import..." statement and runned the program on command Line & it worked. the code is: class Person { String name; int age; Person(String s,int a) { name = s; age = a; } accept() { System.out.println(name+"Hi!!!!!"); System.out.println(age); } } class Demo { public static void main(Strings args[])throws IOException { String name = args[0]; int age = Integer.parseInt(args[1]); Person p = new Person(name,age); p.accept(); } }

3 Answers  


How many Java environments are there?

1 Answers   Phantom Technologies,


Is class forname reflection?

0 Answers  


Why string is a class?

0 Answers  


Which class contains a method: cloneable or object?

0 Answers  


Categories