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



Home Answers Viewqa Java-Beginners Marker interfaces in java

Have Programming Question? Ask it here!
 
 
 


gangaprasad
Marker interfaces in java
2 Answer(s)      3 years and 7 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
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  What interface must an object implement before it can be written to a stream as an object
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
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
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 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
Java: Interfaces
Java: Interfaces An interface is a list of methods that must be defined... does, but abstract classes do allow static method definitions, and interfaces... different interfaces. If a class doesn't define all methods of the interfaces
Hibernate Callback interfaces
Hibernate Callback interfaces  What are Callback interfaces?   Callback interfaces allow the application to receive a notification when something interesting happens to an object?for example, when an object is loaded
Summary: Classes, Interfaces
Java: Summary: Classes, Interfaces Packages package package-name; Class Definition A class definition prototype: visibility class class-name [extends parent-class] [implements interface-name...] { class-body } nameMeaning
interfaces,exceptions,threads
interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW THE COMPLETE CONEPTS OF INTERFACES,EXCEPTIONS,THREADS   Interface... class. In java, multiple inheritance is achieved by using the interface
Implementation code inside interfaces
Implementation code inside interfaces 2001-01-25 The Java Specialists' Newsletter [Issue 006] - Implementation code inside interfaces Author: Dr. Heinz... email or RSS. Welcome to the 6th issue of "The Java(tm) Specialists
Collection Interfaces
Collection Interfaces     ... of several interfaces, and classes that implement those interfaces, contained within... of objects.  Different interfaces describe different types of functionalities
What are the Core interfaces are of Hibernate framework?
What are the Core interfaces are of Hibernate framework?  Hi, What are the Core interfaces are of Hibernate framework? Thanks
Hibernate: core interfaces of hibernate framework
Hibernate: core interfaces of hibernate framework  What are the core interfaces of hibernate framework   Most of hibernate based application code deals with following interfaces provided by the Hibernate Core
Interfaces and Abstract Classes - Development process
Interfaces and Abstract Classes  What are the Scenarios where we use Interface and Abstract Classes?  Hi Friend, Interface: Java does... by using the interface. Interfaces are useful when you do not want classes
java
java  what is marker interface?   Interfaces with no methods is known as marker interfaces. Marker interfaces are Serializable, Clonable, SingleThreadModel, Event listener. Marker Interfaces are implemented
Java API
Java API       Java API Java API is not but a set of classes and interfaces that comes with the JDK. Java API is actually a huge collection of library
Jep's Rich User Interfaces blog
Jep's Rich User Interfaces blog       About AJAX Performance and some other things by Jep Castelein of Backbase Read full Description
java - Java Interview Questions
programming, interfaces with no methods are known as marker interfaces. Marker interfaces are Serializable, Clonable, SingleThreadModel, Event listener. Marker...java  if marker interface is empty how it will give special behaviour
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
Classes and Interfaces of the I/O Streams
Classes and Interfaces of the I/O Streams   ...;Writer It uses for writing to character stream. Interfaces: The following summary of Interfaces provided by the java.io package shown in the table
EJB 3.1 - EJB Interfaces are Optional
In EJB 3.1, now you do not need to define any interfaces for Session Beans, just like JPA Entities and Message Driven Beans. All you have to do is annotate a POJO with the @Stateless or @Stateful to get a fully functional EJB
Identify correct and incorrect statements or examples about the client view of a session bean's local and remote component interfaces.
the client view of a session bean's local and remote component interfaces... the client view of a session bean's local and remote component interfaces... extends Remote (marker) interface.Visit http://java.boot.by 
Graphical User Interfaces
Graphical User Interfaces       A class library is provided by the Java programming language... to the display area with a layout manager. As the Java programming language, the AWT
Identify the interfaces and methods a JMS message-driven bean must implement.
Identify the interfaces and methods a JMS message-driven bean must... Contract Next    Identify the interfaces and methods a JMS... ReservationHomeLocal resHome = (ReservationHomeLocal) jndiContext.lookup ("java
 

 

 

DMCA.com