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



Home Answers Viewqa Java-Interview-Questions difference between marker and tag interface
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


suveer
difference between marker and tag interface
2 Answer(s)      5 years and 11 months ago
Posted in : Java Interview Questions



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


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
Marker interface
Marker interface  what is a marker interface? what is its significance
Advertisements
Marker Interface
Marker Interface  What is the need of Marker Interface?When should we use
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
What are the difference between abstract class and interface?
What are the difference between abstract class and interface?  What are the difference between abstract class and interface
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 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
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 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... of instanceof() . wats d difference Thanks
problem on marker interface - Java Beginners
module,this tag or marker interface is useful. *. In serialization also...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
Marker Interface - Java Interview Questions
Marker Interface   Hi Deepak, Marker interface means....  Hi friend, Marker interface : In java language programming... an error. To make more clearly understand the concept of marker interface you
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 markerImp { } class MarkerTest implements markerImp{ } public class
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
tagged/marker interface in java - Java Beginners
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.... Interfaces with no methods are called marker interfaces and they are used to tag
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 extends thread class vs implements runnable interface - Java Interview Questions
Difference between extends thread class vs implements runnable interface  Hi Friends, can you give difference between extending thread class and implementing runnable interface.  Hi Friend, Difference: 1)If you
difference between == and === operators?
difference between == and === operators?  Is (====) operator available in java or not? difference between
Difference between struts and JSF
Difference between struts and JSF  What is the difference between struts and JSF
difference between ForwardAction and IncludeAction
difference between ForwardAction and IncludeAction  What is the difference between ForwardAction and IncludeAction
difference between SessionState and ViewState
difference between SessionState and ViewState  What is the difference between SessionState and ViewState
Difference between DispatchAction and LookupDispatchAction
Difference between DispatchAction and LookupDispatchAction  What is the Difference between DispatchAction and LookupDispatchAction
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 3d and 4d
Difference between 3d and 4d  what is the difference between 3d and 4d
difference between varchar & varchar2?
difference between varchar & varchar2?  What is the difference between varchar & varchar2
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
Difference between Mysql and SQL
Difference between Mysql and SQL  hello, What is the difference between Mysql and SQL??   hii, SQL is structural quary language but mysql is database package
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 JSP and Servlets
Difference between JSP and Servlets  What is the difference between JSP and Servlets ?   JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP
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
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
Advertisements
 

 

 

DMCA.com