<% pageContext.getOut().println("Hello World"); %>
<% String message = "Hello World"; pageContext.getOut().print(message); %>In this example, the getOut method is used to retrieve a PrintWriter object to print the "Hello World" message to the JSP writer using the print method instead of println. These examples use the javax.servlet.jsp package library.