what is marker interface ? what is the necessity of it?

Answers were Sorted based on User's Feedback



what is marker interface ? what is the necessity of it?..

Answer / sandeep

An interface that contains no methods. Eg: Serializable,
Cloneable, SingleThreadModel etc. It is used to just mark
java classes that support certain capability.

Is This Answer Correct ?    24 Yes 3 No

what is marker interface ? what is the necessity of it?..

Answer / ganesh reddy

markble interface does not contains any methods,but
implementing of these interfaces will be recognise by Jvm
then it will decide that "this class is going do
something".for example for cloneable interface implements
by some class x which consists of a,b variable ,But I need
to interchange instance variables a to b and b to a (pass
by value)of class x and i want again the same values for a
and b.At this situations we can implement cloneable
interface.Like this markble interface are very useful as my
knowledge........

Is This Answer Correct ?    4 Yes 0 No

what is marker interface ? what is the necessity of it?..

Answer / tulasi prasad

this is one type on null interface, it doesn't contain any
methods

Is This Answer Correct ?    3 Yes 1 No

what is marker interface ? what is the necessity of it?..

Answer / prasanna sahu, munnekolal

Marker interface is an interface which gives a mark to the
runtime environment. This gives a mark that "I am going to
happen". It contains no methods.

Is This Answer Correct ?    2 Yes 1 No

what is marker interface ? what is the necessity of it?..

Answer / javaexp

<a
href="http://www.javaexperience.com/java-marker-interfaces/">Marker
interfaces in Java</a> are used for marking a specific
behavior and we can only simulate the behavior by writing
custom interfaces without any methods and having
implementing them by other classes.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

suppose in a class there is a code like this: { Set hs=new Hashset(); hs.add(new Emp("kathy",1000)); hs.add(new Emp("kathy",2000)); } how can u avoid the above code in your class as set won't allow duplicate objects?

3 Answers  


how are methods defined?

0 Answers  


How do I start learning java?

0 Answers  


If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?

0 Answers  


What is default specifier ??? Use of default specifier ???

4 Answers   Cognizant, Syntel,






Why we use set in java?

0 Answers  


What is console based application in java?

0 Answers  


What ide should I use for java?

0 Answers  


What is the concept of multithreading?

0 Answers  


I have a class which is abstract which contains only the abstract methods. This is similar to an interface. Then, if i have given a choice to choose one of them. Which one i have to choose and why?

4 Answers  


Say you want to store the information about a number of pets in an array. Typical information that you could store for each pet (where relevant) would be • Breed of animal • Animal's name • Its birth date • Its sex • Whether it has been sterilised or not • When it is due for its next inoculation • When it last had its wings clipped For each type of pet (eg. dog, cat or bird) you would typically define a class to hold the relevant data. Note: You do not need to implement these classes. Just answer the following questions. 3.1.1 What would be the advantage of creating a superclass (eg. Pet) and declaring an array of Pet objects over simply using an array of Objects, storing each of the instances of the different pet classes (eg. Dog, Cat or Bird) in it? 3.1.2 Would you define Pet as a class or as an interface? Why? (2) (2)

0 Answers  


What is the basically use of finally while we know it is always executed but why?

5 Answers   Oracle, TCS,


Categories