0% found this document useful (0 votes)
7 views12 pages

java_question[1]

The document provides an overview of various Java concepts including Swing features, the ResultSet interface, networking, labels, URLs, ODBC, JDBC architecture, and listener interfaces. It details the functionalities of each concept and includes examples of how to implement them in Java. Additionally, it discusses the AWT class hierarchy and the Type-I JDBC driver, along with methods for TCP/IP communication and database interactions.

Uploaded by

pj507858
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

java_question[1]

The document provides an overview of various Java concepts including Swing features, the ResultSet interface, networking, labels, URLs, ODBC, JDBC architecture, and listener interfaces. It details the functionalities of each concept and includes examples of how to implement them in Java. Additionally, it discusses the AWT class hierarchy and the Type-I JDBC driver, along with methods for TCP/IP communication and database interactions.

Uploaded by

pj507858
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1.List various features of Swing.

Ans: i) light in weight

ii) Rich controls

iii) pluggable look and feel

iv)Platform independent

v) Rich Set of GUI Components

vi) Event Handling

2.Describe ResultSet interface.


Ans: The ResultSet interface in Java is part of the java.sql package. It is used to store and access data
retrieved from a database using a SQL query.It represents a table of data returned by executing a
SELECT query.
3.Define networking.
Ans: Networking in Java refers to the process of connecting two or more computers to share data
using Java APIs. It allows communication over TCP/IP protocols using classes like Socket,
ServerSocket, InetAddress, etc., in the java.net package.

4.Define label.How to create it.

Ans:It is easiest control to use in java.A label displays a single line of read only text. A label is a type
of object of Label. It is passive control.

In Java, you can create a label using the JLabel class from the Swing package.
5.Describe URL.
Ans: In Java, URL stands for Uniform Resource Locator. It is a class in the java.net package used to
represent the address of a resource on the internet or a local network.

The URL class is used to:

• Connect to websites

• Read data from web resources

• Work with internet protocols like HTTP, FTP, and file

6.Explain the ODBC.


Ans: ODBC stands for Open Database Connectivity. It is a standard API used to connect Java (or
other programming languages) to different types of databases.

• Java uses JDBC-ODBC Bridge Driver to connect to databases through ODBC.

• This driver translates JDBC method calls into ODBC function calls.

• It allows Java programs to connect to ODBC-supported databases like MS Access, SQL Server,
etc.

7.Explain 3 tier architecture of JDBC with help of diagram.


Ans: The 3-tier architecture of JDBC divides the system into three layers: Client Layer, Middle Layer
(JDBC API), and Database Layer.

1. Client Layer (Presentation Layer):

• This is the topmost layer where the user interacts with the system.

• The client sends requests for data or actions to the middle layer, like clicking a button or
entering a search query.

2. Middle Layer (JDBC API Layer):

• This layer contains the JDBC API used to connect to the database.

• The client sends SQL queries or commands to this layer, which translates them into JDBC
calls.

• It communicates with the database through a JDBC Driver.

• It also handles database connections, statements, transactions, and result sets.

3. Database Layer (Data Layer):

• This layer is where the actual database resides.

• It processes the SQL queries sent by the middle layer and returns the results.

• The database can be a relational database like MySQL, Oracle, or SQL Server.
8.WAP to demonstrate to use of URL and URL connection
class for communication.
9.WAP to flow layout.
Ans:

10.Explain TYPE-I drive in JDBC.


Ans: A Type-I driver in JDBC is known as the JDBC-ODBC Bridge driver. It uses ODBC (Open Database
Connectivity) to connect Java applications to databases. This driver translates JDBC calls into ODBC
calls, allowing the application to communicate with databases that support ODBC.

• Relies on ODBC to connect Java to databases.

• Not recommended in modern Java (removed in Java 8).

• Slower performance due to the additional translation layer.

• Requires ODBC drivers installed on the client machine.


11.Explain datagram packet in detail.

12.Explain AWT class hierarchy with diagram.


Ans: AWT (Abstract Window Toolkit) is a part of Java used to create Graphical User Interfaces
(GUIs). It provides a set of classes and interfaces for window-based applications.

At the top of the AWT hierarchy is the Component class, which is the base class for all AWT
components.
1. Component

o Base class for all AWT components like buttons, labels, text fields, etc.

2. Container

o A subclass of Component that can hold other components (e.g., Panel, Frame).

3. Panel

o A generic container to hold components. Used as a base for Applet.

4. Applet

o A small application that runs inside a browser or applet viewer.

5. Window

o A top-level container that does not have a menu bar or borders.

6. Frame

o A fully-featured window with a title bar, close/minimize buttons.

7. Dialog

o A pop-up window used for short-term interactions with the user.

Common AWT Components:

These are subclasses of Component:

• Button

• Label

• TextField

• Checkbox

• Choice

• List
13.WAP for TCP/IP client-server communication, exchange of
msg between client-server.
14.WAP to insert a record in student table in DB1.
15.Describe the following listener interface with example:
1)ItemListener 2)KeyListener 3)MouseListener
4)WindowListener
1) ItemListener
The ItemListener interface is used to receive item events, which occur when an item is
selected or deselected. It is commonly used with checkboxes, radio buttons, and list items.

Method: itemStateChanged(ItemEvent e)

2) KeyListener
The KeyListener interface is used to receive keyboard events, which occur when a key is
pressed, released, or typed.

Methods:
• keyPressed(KeyEvent e)
• keyReleased(KeyEvent e)
• keyTyped(KeyEvent e)
3) MouseListener
The MouseListener interface is used to receive mouse events, which occur when the mouse is
clicked, pressed, released, entered, or exited a component.

Methods:

• mouseClicked(MouseEvent e)
• mousePressed(MouseEvent e)
• mouseReleased(MouseEvent e)
• mouseEntered(MouseEvent e)
• mouseExited(MouseEvent e)
4) WindowListener
The WindowListener interface is used to receive window events, which occur when a window
is opened, closed, activated, deactivated, iconified, or deiconified.

Methods:

• windowOpened(WindowEvent e)
• windowClosing(WindowEvent e)
• windowClosed(WindowEvent e)
• windowIconified(WindowEvent e)
• windowDeiconified(WindowEvent e)
• windowActivated(WindowEvent e)
• windowDeactivated(WindowEvent e)
.

You might also like