Pleasw tell me can i write destoy() method inside a service() method of a servlet? if yes what is the need of that?
You can't put any method inside another. I think you want to know if you need to implement the destroy() method in a servlet. It's not required unless you have some cleanup to be done; the destroy() method is called just before the servlet instance is unloaded and put out of service.
For example, if you were opening a connection in the servlet's init() method for use throughout the life of the servlet, you'd want to close() the connection and free up resource when the servlet was done running. You'd put this code in the destroy() method.