Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Marker interfaces in java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


gangaprasad
Marker interfaces in java
2 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


how marker interfaces work?


Advertisement
View Answers

January 19, 2011 at 5:00 PM


Hi Friend,

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.

Example:

interface markerImp {
}

class MarkerTest implements markerImp{
}

public class TestInstanceOf {
public static void main(String []args){
MarkerTest mt = new MarkerTest();
if(mt instanceof markerImp){
System.out.println("True");
}
else{
System.out.println("False");
}
}
}

For more information, visit the following link:

Marker Interface

Thanks



January 19, 2011 at 5:14 PM


By implementing Serializable interface which has no methods and variables, how the class know to save the state of the object?



Related Tutorials/Questions & Answers:
Marker interfaces in java
Marker interfaces in java  how marker interfaces work
Marker Interface,Java Marker Interface
; In this section we will learn about Interface and Marker Interfaces in Java...); } Marker Interface In java language programming, interfaces with no methods are known as marker interfaces. Marker interfaces
Advertisements
Marker Interface - Java Interview Questions
.  Hi friend, Marker interface : In java language programming, interfaces with no methods are known as marker interfaces. Marker interfaces are Serializable, Clonable, SingleThreadModel, Event listener. Marker Interfaces
Marker Interface In Java
marker interfaces are used to inform something to Java compiler for adding special...Marker Interface In Java In this section we will read about marker interface in Java. This section will describe you the various aspects of marker interface
tagged/marker interface in java - Java Beginners
. Interfaces with no methods are called marker interfaces and they are used to tag...tagged/marker interface in java  Hi! what is the exact meaning and usage of of tagged or marker interface. Exactly where we will use it in real
problem on marker interface - Java Beginners
problem on marker interface  i want to know about marker interface... tagged or marker interface is used to just identify the class, in real time... module,this tag or marker interface is useful. *. In serialization also
marker interface - Java Interview Questions
marker interface  how to create our owen marker interface ? can u give me one example  Hi Friend, Try the following code: interface... link: http://www.roseindia.net/java/master-java/interface.shtml Thanks
Java interfaces
Java interfaces  What interface must an object implement before it can be written to a stream as an object
Interface in Java
; In this section we will learn about Interface and Marker Interfaces in Java...;Obj); } Marker Interface In java language programming, interfaces with no methods are known as marker interfaces. Marker interfaces
java interfaces
java interfaces  sample code for multiple interface   interface A { void test(int i); } interface B { void test(String s); } public class MultipleInterface implements A, B { public void test(int i
Marker Interface - Java Interview Questions
Marker Interface   Hi Friends, Marker interface means a method which has no methods. so what is d use of tat. I read "It is used to check that whether the instance belongs to that class". then wat is d use
difference between marker and tag interface - Java Interview Questions
); } Marker Interface 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
java interfaces implementation
java interfaces implementation  hai I have defined one inter face like Maths taking methods like add(), sub(), mul()in interface I take different implementation classes for add() method and sub()and mul() when i trying
interfaces - Java Beginners
, super class constructor runs.what about interfaces?  Hi Friend... is called the base class or the parent class. To derive a class in java the keyword... to : http://www.roseindia.net/java/language/inheritance.shtml Thanks
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces. eg: ---- interface i1
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces in single class? my query
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
interfaces - Java Beginners
interfaces  examples on interfaces  Hi Friend, Please visit the following links: http://www.roseindia.net/java/master-java/interface.shtml http://www.roseindia.net/java/java-exception/create-interface.shtml
interfaces
& interfaces.   An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods... to directly implement one or more interfaces, meaning that any instance of the class
Marker interface
Marker interface  what is a marker interface? what is its significance
Diff Bn Marker Interface and instanceOf - Java Interview Questions
Diff Bn Marker Interface and instanceOf   Hi Friends, Wats d difference bn Marker Interface and instanceOf method. Thanks
Marker Interface
Marker Interface  What is the need of Marker Interface?When should we use
What is a Marker Interface?
What is a Marker Interface?   Hi, What is a Marker Interface? thanks
java
java  What is a Marker Interface?  In java language programming, interfaces with no methods are known as marker interfaces
What are the different types of interfaces in java? - Java Interview Questions
What are the different types of interfaces in java?  Hi, Is it correct question.I faced this in one interview. If yes can u tell me please. thanks chandu
Interfaces in flex
Interfaces in flex  Hi..... Please tell me about... What are - IStyleClient, IChildList, ILayoutManager, IToolTipManagerClient, IInvalidating... interface defines a marker interface. Classes that support this interface
Overview of Networking through JAVA,Getting list of Local Interfaces on a machine
Getting list of Local Interfaces on a machine... to find out the total no of list of local interfaces available on a machine. Here... the local interfaces which are instances of NetworkInterface class and displays
EJB Interfaces
EJB Interfaces       Interface in java means a group of related methods with empty bodies. EJB have generally 4 interfaces. These are as follows 1)Remote interface:- Remote interface
EJB Interfaces
EJB Interfaces       Interface in java means a group of related methods with empty bodies. EJB have generally 4 interfaces. These are as follows 1)Remote interface:- Remote interface
What are Callback interfaces?
What are Callback interfaces?  Hi, What are Callback interfaces? thanks
core java - Java Beginners
; Hi friend, Marker Interface : In java language programming, interfaces with no methods are known as marker interfaces. Marker interfaces are Serializable, Clonable, SingleThreadModel, Event listener. Marker Interfaces
Advertisements
 

 

 

DMCA.com