Well, I need a clarify of what is the importance of the \"\\n\" new line in the String variable here
import java.net.*;
import java.io.*;
The newline has no importance in Java networking.
However it does have importance in many protocols, many of which are based on the 'Telnet Terminal' convention of \r\n
as the line terminator. This certainly includes SMTP, FTP, HTTP, and Telnet itself.
It also has importance for the BufferedReader.readLine()
method. You will find hundreds of questions here about readLine()
blocking forever, to which the answer is 'you are reading lines but you are not writing lines', i.e. just sending a string with no line terminator. This does not constitute a complete line, so readLine()
doesn't return it.