Hi Nishin and Dharmendra. Welcome to the Ranch!
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. There's nothing magical about this - you can always write your own application that can treat any type of class in a specific way - but there's a standard that all servlet containers follow that means you can write a servlet class and know how it will be used.