1. When a servlet is loaded by the container, how many instance of servlets are created? As i understand only one instance is created or is it dependent on the servlet container's implementation ?
One instance of a servlet is created to serve the requests. Multiple instances will be created if your servlet implements SingleThreadModel (deprecated).
2. In page 195 of HFSJ book, it talks about synchronizing or not synchronizing of the service(), but the example given there is synchronizing the doXXX(). Did they mean to say that synchronizing the doXXX() as synchronizing the service() ?
Generally we are not supposed to override the service method. We override the doXXX methods. In that too generally only one of the doXXX methods service a request, so if a GET request is received, doGet method will handle that request, and doPost method will handle a POST request (you are free to call doPost from doGet and vice versa if you want, but I never do that). So if you synchronize the doXXX method(s), then that doXXX method will be able to handle only one request at a time. So if you synchronize the doGet method, then it will serve only one GET request at a time.
3. Can someone give me a real life example where in there is a need for synchronizing the servletContext. It would be really helpful for me to digest that concept.
Synchronizing on the ServletContext is seldom needed. If you are manipulating context scoped attributes and want to do it in a
thread safe manner, you'll synchronize on ServletContext. For example if the number of hits on my application is stored in the ServletContext, then I'll do something like this to increase the hit counter