Ln in Java is the abbreviation of "line", which is used to represent a line of text. It has the following usage: The ln() method of the Scanner class for reading a line of text from the input stream. The ln() method of the PrintWriter class for writing a line of text in the output stream. FileReader and FileWriter The ln() method of the class is used to read and write a line of text from the file respectively.
What does ln mean in Java?
ln is the abbreviation of "line" in Java, which means a line of text. It is used in various ways, depending on the context.
ln in string
When used in Java strings, ln represents a newline character. It is a control character that can be used to wrap text in a string to the next line. For example:
1 2 3 |
|
The ln() method of the Scanner class
The ln() method of the Scanner class is used to read a line of text from the input stream. It returns the string representation of the input line, including newlines. For example:
1 2 |
|
ln() method of PrintWriter class
The ln() method of PrintWriter class is used to write a line of text in the output stream. It writes the given string to the stream, appending a newline character. For example:
1 2 |
|
The ln() method of the FileReader and FileWriter classes
The ln() method of the FileReader and FileWriter classes are used to read a line of text from the file and to File writes a line of text. Their operation is similar to the ln() method of the Scanner and PrintWriter classes, but adapted for file operations.
The above is the detailed content of What does ln mean in java. For more information, please follow other related articles on the PHP Chinese website!