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.
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
.
maroun
and marounln
. –
Adept 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.
fooln
to mean do foo
followed by a move to next line operation. –
Bleachers print + \n
) or for an abbreviation of line. But that interesting part of the question is probably off-topic for SO. –
Pattiepattin \n
because that's a "C"ism, and Pascal had writeln
before C existed. –
Bleachers #13#10
wasn't it ?). –
Pattiepattin 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.
© 2022 - 2024 — McMap. All rights reserved.