While working with Selenium, we need session handling. This is because, during test execution, Selenium WebDriver has to interact with the browser all the time to execute the given commands. It is also possible that, before the current execution completes, someone else starts the execution of another script on the same machine and in the same type of browser. So, to avoid such a situation, we need session handling.
Also, check out the blog on how to use Selenium with Java.