Question: what is the difference between java class and servlet?
Answer: A servlet class is just the same as any other Java class. As far as the language is concerned, it's not treated any differently. The difference is what is done to them. A servlet container (e.g. Tomcat) is designed to be able to recognise servlet classes and, if configured correctly, treat them in a particular way.