difference between marker and tag interface

difference between marker and tag interface

View Answers

December 20, 2008 at 5:18 AM

Hi friend,

nterface Definition
visibility mode interface interfaceName{
constant variable declarations
abstract method declarations
}

e.g.

public interface RacingCar{
public void startcar (int Obj);
public void changegear (int Obj);
public void incrrace (int Obj);
public void stopcar (int Obj);
}

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 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.

For more information visit to :

http://www.roseindia.net/java/master-java/interface.shtml

Thanks

December 20, 2008 at 6:41 AM

Hi friend,

Tag interface

The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class. It defines the life cycle and the methods to be invoked at start and end tag.

There are several methods that get invoked to set the state of a Tag handler. The Tag handler is required to keep this state so the page compiler can choose not to reinvoke some of the state setting.

marker interface

The marker interface pattern is a design pattern in computer science, used with languages that provide run-time type information about objects. It provides a means to associate metadata with a class where the language does not have explicit support for such metadata.

To use this pattern, a class implements a marker interface, and methods that interact with instances of that class test for the existence of the interface. Whereas a typical interface specifies functionality (in the form of method declarations) that an implementing class must support, a marker interface need not do so. The mere presence of such an interface indicates specific behavior on the part of the implementing class. Hybrid interfaces, which both act as markers and specify required methods, are possible but may prove confusing if improperly used.

An example of the application of marker interfaces from the Java programming language is the Serializable interface. A class implements this interface to indicate that its non-transient data members can be written to an ObjectOutputStream. The ObjectOutputStream private method writeObject() contains a series of instanceof tests to determine writeability, one of which looks for the Serializable interface. If none of these tests pass, the method throws a NotSerializableException.



Thanks.

Ads









Related Tutorials/Questions & Answers:
difference between marker and tag interface - Java Interview Questions
difference between marker and tag interface  what is the difference between marker interface and tag interface?  Hi friend, nterface... The Tag interface defines the basic protocol between a Tag handler and JSP page
Difference between abstract class and an interface
Difference between abstract class and an interface The difference between... search for overridden methods. There is no any difference between a interface... between abstract class and interface in java. Abstract class is a class
Advertisements
Marker interface
Marker interface  what is a marker interface? what is its significance
What is the difference between component and tag in JSF?
What is the difference between component and tag in JSF?  Please let me know,becaus i am new to jsf and am confusing
Marker Interface,Java Marker Interface
; In this section we will learn about Interface and Marker Interfaces in Java. This tutorial will clarify you questions "What is marker Interface?" and "Why use Marker Interface?" and "difference between abstract
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
Marker Interface In Java
special behavior. Marker interface implemented class, like a tag, notifies...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
Difference between class,name,id attributes in each JSP tag
Difference between class,name,id attributes in each JSP tag  Can i know the difference between class,name,id attributes in each JSP tags.................. These 3 are only used for reference ..... And what are the differernces
Difference between struts and JSF
Difference between struts and JSF  What is the difference between struts and JSF
difference between == and === operators?
difference between == and === operators?  Is (====) operator available in java or not? difference between
Difference between 3d and 4d
Difference between 3d and 4d  what is the difference between 3d and 4d
What is the difference between the >> and >>> operators?
What is the difference between the >> and >>> operators?   hi, What is the difference between the >> and >>> operators? Thanks
Difference between Timer and Thread?
Difference between Timer and Thread?  Can anyone tell me about the difference between Timer and Thread, Why we need to have Timer in case we have Thread implimentation startegy in Java
what is the difference between extends and implements
what is the difference between extends and implements  difference between extends and implements
what is the difference between extends and implements
what is the difference between extends and implements  difference between extends and implements
difference between lock and synchronization
difference between lock and synchronization  Hi, I am new in java please anyone tell me difference between lock and synchronization in java. its urgent. Thank in advance   Please visit the following link: Lock
Difference between SCJP Exams
Difference between SCJP Exams  What is the differences between SCJP 5 (310 - 055) exam and SCJP 6 (310 - 065) exam??? Thank You In Adv
Difference between Struts and Spring
Difference between Struts and Spring  What are the difference between... tag Library while Spring does not. 5)Spring is loosely coupled while Struts... while Spring is light weight. 4)Struts supports tag Library while Spring does
what is the Difference between weblogic and jboss?
what is the Difference between weblogic and jboss?  what is the Difference between weblogic and jboss
what is the difference between pop and oop
what is the difference between pop and oop  what is the difference between pop and oop
What is the difference between hibernate and spring
What is the difference between hibernate and spring  Hi, What is the difference between hibernate and spring. Thanks
What is the difference between $message and $$message?
What is the difference between $message and $$message?  What is the difference between $message and $$message
difference between hashcode,reference in java
difference between hashcode,reference in java  difference between hashcode,reference in java
What is the difference between a constructor and a method?
What is the difference between a constructor and a method?  Hi, What is the difference between a constructor and a method?   Hi, I have found a good link of Java program related to difference between constructor
Difference between http and https
Difference between http and https  Difference b/w HTTP and HTTPS please provide answer in tabular form.   Hi Friend, Differences: 1)HTTP is hyper text transfer protocol which is responsible for transmitting
Difference between error and exception ????????
Difference between error and exception ?  Can we handle a error in java if yes than give an code of an example? Difference between error and exception handling.......   Exceptions are things you can create/throw
difference between $message and $$message
difference between $message and $$message  What is the difference between $message and $$message?   Hi friends, $message is a simple variable whereas $$message is a reference variable. Example: $name = 'Bharat
calculate difference between two dates
calculate difference between two dates  hi, I was actually working on to calculate the number of days between two dates of dd/mm/yyyy format... the difference between the two dates
difference between prepared statement and statement
difference between prepared statement and statement  i mean in prepared statement we write insert command as INSERT INTO tablename VALUES...(),jtextfield2.getText()); whats the difference between these two and which is more
mysql difference between two numbers
mysql difference between two numbers  How to get total bate difference between two dates for example 1/01/2012 and 1/02/2012 in MYSQL?   ..., '01/02/2012', 103))   DATEDIFF() in MYSQL always returns the difference

Ads