HttpServletResponse response;
PrintWriter out = response.getWriter();
out.print("Hello");
out.println("HelloWorld");
My question seem silly, but In Servlet, I see that both print() and println() do same thing !!!
If you want to go to another line, you must put <br>
tag at the end of String.
Thanks :)
println
appends a new line ( \\n
) after the printed text. New lines are not interpreted within HTML, therefore you won't see a difference between the output of println
and print
within the rendered HTML.
They don't do the same thing. println
appends an end-of-line marker after the string.
The fact that that end-of-line isn't rendered by browers is another issue. Depending on what content-type you're outputing, it could be significant or not.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.