ServletOutputStream is used to generate output for the client (who calls the Servlet). In the example below, response is instance of HttpServletResponse.

Java Code:
    ServletOutputStream out = response.getOutputStream();

    out.println("<html>");
    out.println("<head>");
    out.println("<title>Hello World</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<b>Hello World</b>");
    out.println("</body>");
    out.println("</html>");
    out.close();