Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

println method - what do the last 2 letters (l & n) stand for?

Tags:

java

out

println

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.

like image 326
user2911290 Avatar asked Nov 25 '13 09:11

user2911290


2 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.

like image 95
Alnitak Avatar answered Nov 05 '22 04:11

Alnitak


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.

like image 38
MusicLovingIndianGirl Avatar answered Nov 05 '22 05:11

MusicLovingIndianGirl