this post was submitted on 05 Apr 2025
145 points (88.4% liked)

Programmer Humor

30248 readers
1672 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] schnurrito@discuss.tchncs.de 2 points 11 months ago (1 children)

Kinda in Java, you can call System.out.println or you can call System.out.print and explicitly write the newline.

[–] uranibaba@lemmy.world 2 points 11 months ago (1 children)

I haven't looked at the code but I always assumed that println was a call to print with a new line added to the original input.
Something like this:

void print(String text) { ... }
void println(String text) { this.print(text + '\n'); }
[–] Scoopta@programming.dev 2 points 11 months ago (1 children)

That is pretty much what it does except it doesn't hardcode \n but instead uses the proper line ending for the platform it's running on.

[–] uranibaba@lemmy.world 1 points 11 months ago

I haven't worked with java for a couple of months now, currently working in Delphi, so could not remember the how else to do new line except backslash n on top of my head. :-)