0% found this document useful (0 votes)
8 views6 pages

Java Oral Answers

Uploaded by

chowhanaayan1
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)
8 views6 pages

Java Oral Answers

Uploaded by

chowhanaayan1
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/ 6

JAVA ORAL ANSWERS

1. **AWT (Abstract Window Toolkit)**


- A Java library used for creating graphical user interfaces (GUIs) in applications.

2. **Component**
- A graphical element in a GUI, such as a button, label, or text field.

3. **Container**
- A component that can hold other components, like a panel or frame.

4. **Window Class**
- A top-level container without borders or menu bars, used for creating windows.

5. **Panel**
- A simple container for organizing components within a window or another container.

6. **Frame**
- A top-level window with borders and a title, commonly used for standalone applications.
Example: `Frame frame = new Frame("My Frame");`

7. **Method**
- A block of code that performs a specific task and can be called when needed.

8. **setSize Method**
- Used to set the width and height of a GUI component or container.

9. **Applet**
- A small Java program that runs in a web browser or applet viewer.

10. **AWT Controls**


- Includes Button, Label, Checkbox, TextField, TextArea, List, and Choice.

11. **Create a Button**


- `Button button = new Button("Click Me");`

12. **setText() and getText() Methods**


- `setText()`: Sets the text of a component.
- `getText()`: Retrieves the text from a component.

13. **Default Scrollbar**


- Vertical scrollbar is present by default.

14. **Difference: TextField vs. TextArea**


- TextField: For single-line text input.
- TextArea: For multi-line text input.
15. **Types of Layout Managers**
- **FlowLayout**: Arranges components in a row.
- **BorderLayout**: Divides container into regions (North, South, East, West, Center).
- **GridLayout**: Arranges components in a grid.
- **CardLayout**: Manages multiple components, showing one at a time.
- **GridBagLayout**: Flexible and complex layout.

16. **Default Layout**


- **FlowLayout** for Applet and Panel.

17. **Purpose of Dialog Box**


- Used for displaying messages or taking input in a small, separate window.

18. **File Dialog**


- A dialog box for selecting or saving files.

19. **Color Class Methods**


- `getRGB()`: Returns RGB value.
- `brighter()`: Makes color brighter.
- `darker()`: Makes color darker.
- `equals()`: Compares colors.

20. **Swing**
- An advanced GUI toolkit in Java, part of the Java Foundation Classes (JFC).

21. **Features of Swing**


- Lightweight, customizable, platform-independent, and supports MVC.

22. **Difference: Swing vs. AWT**


- Swing is lightweight, extensible, and uses a richer set of components than AWT.

23. **JComponent and JContainer**


- **JComponent**: Base class for Swing components like JButton.
- **JContainer**: Base for containers like JFrame.

24. **Methods to Close JFrame**


- `setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);`

25. **Types of Swing Buttons**


- JButton, JToggleButton, JCheckBox, JRadioButton.

26. **JTabbedPane**
- Allows multiple tabs within a single window.

27. **Tree Node Manipulation**


- Use `DefaultTreeModel` to add/remove or change nodes.
28. **Table in Scroll Pane**
- Create a JTable and add it to a JScrollPane.

29. **Uses**
- **JProgressBar**: Shows task progress.
- **JToolTip**: Displays tooltips.
- **JSlider**: Adjusts values within a range.
- **JDialog**: Displays dialog boxes.

30. **MVC Architecture**


- Separates application into Model (data), View (UI), and Controller (logic).

31. **Event**
- An action that occurs, such as a button click.

32. **Source**
- The object that generates an event.

33. **Event Classes**


- Includes ActionEvent, ItemEvent, KeyEvent, MouseEvent, etc.

34. **When ActionEvent Occurs**


- Triggered when a button is clicked or menu item selected.

35. **When ItemEvent Occurs**


- Triggered when an item in a checkbox or choice is selected.

36. **When KeyEvent Occurs**


- Triggered when a key is pressed, released, or typed.

38. **Types of Mouse Events**


- Clicked, Pressed, Released, Entered, Exited, Moved, Dragged.

39. **Types of Window Events**


- Opened, Closing, Closed, Activated, Deactivated, Iconified, Deiconified.

40. **Adapter Class**


- Simplifies event handling by providing default implementations for event listener interfaces.

41. **Socket**
- A communication endpoint for sending/receiving data over a network.

42. **IP (Internet Protocol)**


- A set of rules for addressing and routing data.

43. **Proxy Server**


- Acts as an intermediary between clients and servers.
44. **Reserved Ports**
- Ports 0–1023 are reserved for well-known services.

45. **Internet Addressing**


- Assigning unique IP addresses to devices on a network.

46. **IP Class Ranges**


- Class A: 0.0.0.0 to 127.255.255.255
- Class B: 128.0.0.0 to 191.255.255.255
- Class C: 192.0.0.0 to 223.255.255.255
- Class D: 224.0.0.0 to 239.255.255.255

47. **Factory and Instance Methods**


- **Factory Method**: Creates objects without specifying exact class.
- **Instance Method**: Operates on an instance of a class.

48. **Steps: TCP/IP Client**


- Create a socket, connect to server, send/receive data.

49. **Steps: TCP/IP Server**


- Create a server socket, accept client connection, communicate.

50. **Use of Class URL**


- Represents a Uniform Resource Locator for accessing web resources.

51. **URL Parameters**


- Protocol, hostname, port, and file.

52. **Use of URLConnection**


- Connects to a URL for communication. Steps: Open connection, send/receive data.

53. **DatagramPacket and DatagramSocket**


- **DatagramPacket**: Represents data in UDP communication.
- **DatagramSocket**: Sends/receives packets.

54. **Difference: TCP vs. UDP**


- TCP: Reliable, connection-oriented.
- UDP: Unreliable, connectionless.

55. **JDBC-ODBC Driver**


- A bridge driver to connect Java applications to ODBC databases.

56. **JDBC Characteristics**


- Platform-independent, supports SQL.
- Steps: Load driver, establish connection, execute queries.

57. **Types of JDBC Drivers**


- Type-1: JDBC-ODBC Bridge
- Type-2: Native-API
- Type-3: Network Protocol
- Type-4: Thin Driver.

58. **JDBC Classes**


- **DriverManager**: Manages JDBC drivers.
- **Class Class**: Loads classes dynamically.

59. **JDBC Interfaces**


- **Connection**: Manages database connection.
- **Statement**: Executes SQL queries.
- **PreparedStatement**: Executes precompiled queries.
- **CallableStatement**: Executes stored procedures.
- **ResultSet**: Retrieves query results.

60. **Servlet**
- A Java class for handling web requests and responses.

61. **Advantages of Servlets**


- Faster, platform-independent, and reusable.

62. **CGI**
- Common Gateway Interface for web-based scripts.

63. **Benefits of Servlets**


- Better performance, session tracking, and easier integration.

64. **Servlet Life Cycle**


- init(), service(), destroy().

65. **Servlet API Packages**


- javax.servlet, javax.servlet.http.

66. **javax.servlet Interfaces**


- Provide methods for servlet configuration and lifecycle.

67. **javax.servlet Classes**


- Provide stream handling and other utilities for servlets.

68. **javax.servlet.http Interfaces**


- For handling HTTP-specific requests and sessions.

69. **javax.servlet.http Classes**


- Include Cookie, HttpSessionEvent, and others for HTTP functionality.

70. **doGet and doPost**


- doGet: Handles GET requests.
- doPost: Handles POST requests.
71. **Cookies**
- Store client data. Types: Session and Persistent.

72. * Cookie Operations *


- Send: Use `response.addCookie()`.
- Retrieve: Use `request.getCookies()`.
- Destroy: Set cookie age to 0.

73. **Session and Tracking**


- Manages user state in a web app.

74. **Session Creation and Tracking**


- Create: Use `HttpSession`.
- Methods: Cookies, URL rewriting, hidden fields.

75. **JSP**
- Java Server Pages for dynamic web content.
- Advantages: Easy to write, integrates with Java.

76. **JSP Life Cycle**


- Translation, Compilation, Initialization, Execution, Destruction.

You might also like