java_question[1]
java_question[1]
iv)Platform independent
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.
• Connect to websites
• 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.
• 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.
• 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 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:
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
4. Applet
5. Window
6. Frame
7. Dialog
• 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)
.