cm0002@lemmy.world to Programmer Humor@programming.dev · 4 days agoDoes this exist anywhere outside of C++?imagemessage-square58fedilinkarrow-up1164cross-posted to: [email protected]
arrow-up1164imageDoes this exist anywhere outside of C++?cm0002@lemmy.world to Programmer Humor@programming.dev · 4 days agomessage-square58fedilinkcross-posted to: [email protected]
minus-squareuranibaba@lemmy.worldlinkfedilinkarrow-up2·4 days agoI 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'); }
minus-squareScoopta@programming.devlinkfedilinkarrow-up2·4 days agoThat 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.
minus-squareuranibaba@lemmy.worldlinkfedilinkarrow-up1·1 day agoI 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. :-)
I haven’t looked at the code but I always assumed that
println
was a call toprint
with a new line added to the original input.Something like this:
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.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. :-)