The getSessionID method of the Session class returns a string that is the identifier set for the session.
public String getSessionID();