Question

I guess it's related to println()'s newline functionality ('\n'), but in abbreviated letter-based form, that would be nl rather than ln. Thank you for any comments.

Was it helpful?

Solution

It's historic.

Pascal had write and writeln.

write would output a string, leaving the cursor at the end of that string.

writeln (where ln was short for "line") would write a whole line of text and move the cursor to the start of the next line, typically by automatically appending a CRLF or some other OS-dependent control sequence.

Java inherited the abbreviation, but used print instead of write.

OTHER TIPS

Hi check if this is helpful..

http://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html

You can find it under the heading Class PrintStream

ln simply means LINE - it prints the character/string in a NEW LINE.

println stands for printline.

There is nothing special about it :P It will print a new line instead of printing it on the same line.

println() method Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

 public void println() {
     newLine();
 }

Also, there are overloaded methods println(String s), println(Char c), println(Double d), println(Float f), println(Long l), println(int i), println(bool b).

Here is a link which gives all code.
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/PrintStream.java#PrintStream.println%28%29.

println -> print line.

That means that it will print the line you gave it through the parameter, and goes with the cursor to the next line, waiting for another input.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top