Multiple choice technology programming languages

What does getSession(false) will do?

  1. Create new session if the session does not already exist

  2. Returns null if session does not already exist

  3. Returns false

  4. Destroy the session

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Calling request.getSession(false) retrieves the current active session associated with the request. If no session exists, it returns null instead of creating a new one, which is useful for checking session validity without overhead.