Advanced Java Programming – Viva Answers
UNIT I – Event Handling
Event handling is the mechanism to respond to user actions like mouse clicks or key presses.
An event is an object that represents a change in state of a component.
Event source is the component that generates the event.
Event listener is an interface that handles events.
Event Delegation Model transfers event handling to listeners.
EventObject is the superclass of all events.
Adapter classes provide default implementations of listeners.
UNIT II – Swing
Swing is a GUI toolkit for Java.
Swing is platform-independent while AWT is platform-dependent.
JFrame is a main window; JPanel is a container.
JButton is used for clicking actions.
JLabel displays text or image.
Layout manager controls component positioning.
UNIT III – JDBC
JDBC connects Java applications with databases.
JDBC drivers are Type 1, 2, 3, and 4.
DriverManager manages database drivers.
Connection represents database connection.
Statement executes SQL queries.
PreparedStatement is faster and secure.
ResultSet stores query results.
UNIT IV – JSP & JavaBeans
JSP creates dynamic web pages.
Servlet uses Java code; JSP uses HTML with Java.
JSP implicit objects include request, response, session.
JavaBean is a reusable Java class.
jsp:useBean accesses JavaBeans.
UNIT V – Networking & EJB
Networking connects computers to share data.
TCP is reliable; UDP is faster.
Socket is an endpoint for communication.
EJB are server-side components.
Stateful beans maintain state; Stateless do not.
Common Viva
Java is platform-independent due to JVM.
Garbage collection manages memory automatically.
Serialization converts object into byte stream.