Question - Explain the steps involved in placing a servlet within a package? 
          
        
        Answer - 
        
The Packages are used to separate the servlets under a directory to eradicate confusion among programmers working simultaneously on creating servlets on the same server. This can be done through the following steps:
- Sorting of files into different subdirectories by matching the package name to the subdirectory name to organize the packages.
 - After sorting the packages into subdirectories insert the package statement in the class file.
 
Let us understand through this an example as follows:
- import java.io.*;
 - import javax.servlet.*;
 - import javax.servlet.http.*;
 - public class servlet1 extends HttpServlet{
 -       public void doGet(HttpServletRequest request, HttpServletResponse response)
 -       throws ServletException, IOException {
 -              response.setContentType("text/html");
 -              PrintWriter out = response.getWriter();
 -              String docType = "n";
 -              out.println(docType + "n" + "Edurekan" + "n" + "");
 -       }
 - }