Skip to main content

out.print vs output.println?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
shahin912
Offline
Joined: 2011-09-30

Whats the difference between these?

out.print

output.println

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
OneJumpedUp
Offline
Joined: 2012-04-05

Hey
Yep this is a trick for new players

out.print( "Hello there " );
out.print( "Everybody" );

displays:
Hello there Everybody

without breaking the line, whereas:

out.println( "Hello there " );
out.println( "Everybody" );

displays:
Hello there
Everybody

breaking the line