Advanced questions
Advanced questions
1. Basic Understanding
o What is the difference between java.util.Date and the new java.time API introduced
in Java 8?
o How do you create the current date and time using the LocalDateTime class?
2. Usage Examples
o Write a program to calculate the difference between two dates using the java.time
package.
3. Advanced
o How does the ZonedDateTime class handle time zones? Provide an example.
o Write a program to calculate the number of days between today and a user-defined
date.
Inner Classes
1. Types
2. Practical Usage
3. Advanced
o How do you access a member variable of the enclosing class from a non-static inner
class?
Method References
1. Introduction
o What are method references in Java, and how are they related to lambda
expressions?
3. Advanced
o How can you use method references with streams? Provide an example.
Lambda Expressions
1. Basic Understanding
o Can you provide a use case where a lambda expression simplifies code?
3. Functional Interfaces
o What are functional interfaces in Java, and how are they related to lambda
expressions?
o Name some commonly used functional interfaces in Java. Can you demonstrate the
use of one with a lambda expression?
4. Limitations
o Are lambda expressions allowed to modify local variables? Why or why not?
1. Basics
o How do lambda expressions improve the readability and conciseness of the code?
2. Examples
3. Advanced
o Explain the concept of "effectively final" variables in the context of lambda
expressions.
JDBC
1. Basics
2. Queries
3. Error Handling
o How can you handle SQL exceptions in JDBC effectively? What is the purpose of the
SQLException class?
4. Performance
JDBC
5. Basics
6. Examples
7. Advanced
8.
Servlets
1. Lifecycle
o What are the different methods of the HttpServlet class, and when are they called?
3. Session Management
o What is the difference between cookies and URL rewriting for session tracking?
4. Error Handling
Servlets
1. Lifecycle
2. Request Handling
3. Advanced
o How do you handle session management in servlets? Compare cookies and URL
rewriting.
Stream API
1. Overview
o What is the Stream API in Java, and how does it differ from traditional loops?
o What is the difference between intermediate and terminal operations in the Stream
API?
3. Examples
o Write a Stream API example to find the maximum number in a list of integers.
o How can you use the Stream API to group elements of a collection by a specific
property (e.g., group students by grade)?
4. Advanced
o How can you use the Stream API to process a large dataset in parallel?
o Explain the difference between map and flatMap in the Stream API.Stream API
1. Core Concepts
o How do you differentiate between map and flatMap in the Stream API?
2. Examples
o Write a program to count the number of elements in a list that satisfy a given
predicate.
o How can you use the Stream API to merge two lists?
3. Advanced
o What are parallel streams, and when should you avoid using them?
o Provide an example of using the reduce() method in the Stream API to calculate a
result.
Let me know if you'd like detailed answers for these questions or if you'd like me to export this
content to a PDF!