Sunday 24 March 2013

What is an event and what are the models available for event handling?


What is an event and what are the models available for event handling?  
An event is an event object that describes a state of change in a source. In other words, event occurs when an action is generated, like pressing button, clicking mouse, selecting a list, etc. There are two types of models for handling events and they are: a) event-inheritance model and b) event-delegation model.

What are the advantages of the model over the event-inheritance model?


What are the advantages of the model over the event-inheritance model?  
The event-delegation model has two advantages over the event-inheritance model. They are: a)It enables event handling by objects other than the ones that generate the events. This allows a clean separation between a component’s design and its use. b)It performs much better in applications where many events are generated. This performance improvement is due to the fact that the event-delegation model does not have to be repeatedly process unhandled events as is the case of the event-inheritance.

What is source and listener?


What is source and listener?  
source : A source is an object that generates an event. This occurs when the internal state of that object changes in some way. listener : A listener is an object that is notified when an event occurs. It has two major requirements. First, it must have been registered with one or more sources to receive notifications about specific types of events. Second, it must implement methods to receive and process these notifications.

What is adapter class?


What is adapter class?  
An adapter class provides an empty implementation of all methods in an event listener interface. Adapter classes are useful when you want to receive and process only some of the events that are handled by a particular event listener interface. You can define a new class to act listener by extending one of the adapter classes and implementing only those events in which you are interested. For example, the MouseMotionAdapter class has two methods, mouseDragged()and mouseMoved(). The signatures of these empty are exactly as defined in the MouseMotionListener interface. If you are interested in only mouse drag events, then you could simply extend MouseMotionAdapter and implement mouseDragged() .

Blog Author: Vijay Kumar


What is meant by controls and what are different types of controls in AWT?


What is meant by controls and what are different types of controls in AWT?  
Controls are components that allow a user to interact with your application and the AWT supports the following types of controls: Labels, Push Buttons, Check Boxes, Choice Lists, Lists, Scrollbars, Text Components. These controls are subclasses of Component.

Blog Author: Vijay Kumar


What is the difference between choice and list?


What is the difference between choice and list?  
A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices and only one item may be selected from a choice. A List may be displayed in such a way that several list items are visible and it supports the selection of one or more list items.

Blog Author: Vijay Kumar


What is the difference between set and list?


What is the difference between set and list?  
Set stores elements in an unordered way but does not contain duplicate elements, whereas list stores elements in an ordered way but may contain duplicate elements.

Blog Author: Vijay Kumar


What is an I/O filter?


What is an I/O filter?  
An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

Blog Author: Vijay Kumar


What is serialization and deserialization?


What is serialization and deserialization?  
Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.

Blog Author: Vijay Kumar


What is JDBC?


What is JDBC? 
 JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications.

Blog Author: Vijay Kumar


What are drivers available?


What are drivers available?  
a) JDBC-ODBC Bridge driver 
b) Native API Partly-Java driver 
c) JDBC-Net Pure Java driver 
d) Native-Protocol Pure Java driver

Blog Author: Vijay Kumar


What is the difference between JDBC and ODBC?


What is the difference between JDBC and ODBC?  
a) OBDC is for Microsoft and JDBC is for Java applications. b) ODBC can’t be directly used with Java because it uses a C interface. c) ODBC makes use of pointers which have been removed totally from Java. d) ODBC mixes simple and advanced features together and has complex options for simple queries. But JDBC is designed to keep things simple while allowing advanced capabilities when required. e) ODBC requires manual installation of the ODBC driver manager and driver on all client machines. JDBC drivers are written in Java and JDBC code is automatically installable, secure, and portable on all platforms. f) JDBC API is a natural Java interface and is built on ODBC. JDBC retains some of the basic features of ODBC.

Blog Author: Vijay Kumar


What are the types of JDBC Driver Models and explain them?


What are the types of JDBC Driver Models and explain them?  
There are two types of JDBC Driver Models and they are: a) Two tier model and b) Three tier model Two tier model: In this model, Java applications interact directly with the database. A JDBC driver is required to communicate with the particular database management system that is being accessed. SQL statements are sent to the database and the results are given to user. This model is referred to as client/server configuration where user is the client and the machine that has the database is called as the server. Three tier model: A middle tier is introduced in this model. The functions of this model are: a) Collection of SQL statements from the client and handing it over to the database, b) Receiving results from database to the client and c) Maintaining control over accessing and updating of the above.

Blog Author: Vijay Kumar