Which annotation is used to specify that a method should be invoked after a session is invalidated in a Java web application?
A. `@WebListener`
B. `@Resource`
C. `@PostConstruct`
D. `@PreDestroy`
Answer: Option D
A. `@WebListener`
B. `@Resource`
C. `@PostConstruct`
D. `@PreDestroy`
Answer: Option D
What is the purpose of the `@WebServlet` annotation in a Java web application?
A. To declare a servlet and its mapping
B. To define JavaBean properties
C. To execute SQL queries
D. To create JavaBeans
In a Java web application, what is the role of the `ServletContext` object?
A. It creates JavaBeans
B. It executes SQL queries
C. It defines JavaBean properties
D. It provides access to application-wide information and resources
What is the primary purpose of the `@PostConstruct` annotation in Java EE applications?
A. To define JavaBean properties
B. To execute SQL queries
C. To specify a method to be executed after an instance is created and its dependencies are injected
D. To create JavaBeans
In Java EE applications, what is the purpose of the `@Resource` annotation?
A. To execute SQL queries
B. To specify a resource to be injected into a component
C. To create JavaBeans
D. None of These
Join The Discussion