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.

- 44,383
- 11
- 84
- 103

- 1,396
- 1
- 16
- 26
-
6println - print line. Meaning it will use **\n** at the end of the printed line. – Tafari Nov 25 '13 at 09:47
-
Its not asking to print new line but it prints the given line with \n at the end. – Govan Nov 25 '13 at 09:48
-
println - Print a line(a complete line, which is terminated with a new line character(default line separator) or the line separator property). – Rahul Nov 25 '13 at 09:49
-
If you got your answer, go ahead and accept it. Please do not add it to your question. It defeats the whole purpose of a Q&A if you're going to include the answer in your question itself. Or else, if you've something new to share with us(which hasn't been posted already), you can post a new answer to your own question also. – Rahul Nov 25 '13 at 10:03
5 Answers
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
.

- 334,560
- 70
- 407
- 495
-
1I'll consider this in my future language. I'll call it `maroun` and `marounln`. – Maroun Nov 25 '13 at 09:59
-
-
Really? When I learned Java, I first thought, that it is PrintIn() (with the upper case i) :-) – User123 Mar 28 '20 at 13:34
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.

- 5,909
- 9
- 34
- 65
-
1
-
Why not? He just wanted to know what ln stands for and a link to verify that – MusicLovingIndianGirl Nov 25 '13 at 09:52
-
@Aishvarya agree, however I wouldn't post an **answer** but rather a **comment** to answer this question. – Tafari Nov 25 '13 at 09:54
-
1*Hi check if this is helpful.* - This really shouldn't be the first line of an answer, IMHO. It looks like a suggestion at the most. – Rahul Nov 25 '13 at 10:01
-
What he is saying is convincing, ln stands for Line not New Line, and that why its ln not nl – kdureidy Nov 25 '13 at 10:04
-
-
1actually it _doesn't_ print it _in_ a new line. It ensures that the _next_ output will appear on a new line. – Alnitak Nov 25 '13 at 10:10
-
@Tafari Fair enough. Link only answers already on board now. And the last line might be some light yet OP him self proposed that :) – Suresh Atta Nov 25 '13 at 10:13
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.

- 638
- 10
- 23
-
5A source would be welcome. OP asks what it stands for, and it's possible to find other hypothesis, like the fact "ln" looks like "\n". – Denys Séguret Nov 25 '13 at 09:48
-
2Referring to your edit - *It will print a new line instead of printing it on the same line*. Wrong. it'll print the line and end it with a new line character. – Rahul Nov 25 '13 at 09:50
-
@R.J According to http://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println(java.lang.String), it will print the string and then invoke println() meaning it will print a new empty line. – user1021726 Nov 25 '13 at 09:51
-
The order is important here. If nothing is specified, it prints nothing(blank) and terminates it with the new line character. – Rahul Nov 25 '13 at 09:52
-
@dystroy IMO OP is just overthinking it. Confusing \n with nl or ln. In regards to his question of what "ln" stands for: it stands for line. – user1021726 Nov 25 '13 at 09:56
-
@dystroy the source is history - other languages used `fooln` to mean do `foo` followed by a _move to next line_ operation. – Alnitak Nov 25 '13 at 10:13
-
@Alnitak I know that. What I'm curious about is if historically "ln" stands for "\n" (like `print + \n`) or for an abbreviation of line. But that interesting part of the question is probably off-topic for SO. – Denys Séguret Nov 25 '13 at 10:18
-
1@dystroy no, it doesn't (and AFAIK cannot) stand for `\n` because that's a "C"ism, and Pascal had `writeln` before C existed. – Alnitak Nov 25 '13 at 10:21
-
@Alnitak That's a damn good point there. I had totally forgotten the pascal literals (`#13#10` wasn't it ?). – Denys Séguret Nov 25 '13 at 10:23
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.

- 3,287
- 3
- 32
- 45
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.

- 588
- 4
- 10