Homework? Listen, I don't purport to know anything about Java, so I'm not going to wax poetic about how I think Java sucks, or can't do fully available sessions across an enterprise.
What I CAN tell you is that the two other people who replied to your message are right -- PHP gives you the API to store your sessions anywhere you want. I choose a nicely replicated and fully redundant MySQL setup, storing sessions in the DB. This allows each of the 5 web servers running the PHP code to access the same session data regardless of which of the 5 servers you go to. It accesses the same data, allowing two clients on two different servers to add/change/delete data, allowing MySQL to handle the blocking/locking.
I'm sure you can tell us how Java does this -- I don't really care though. The point is that a language doesn't have to do everything, and one that does everything probably has some bloat going on. Does Java replicate sessions between servers? Why? Why should your programming language be responsible for something like that, when it could just provide an API to whatever method of session storage you wanted?