+ 1

How can I leave one line empty after the code?

Hello everybody. Tell me please, how can I leave one line empty after the code? System.out.prinln("Hello"); System.out.prinln("world!"); __________________________ Hello world! But I need: Hello <----one line empty world! How can i do this?

22nd Aug 2017, 11:11 PM
BVP
BVP - avatar
3 Respuestas
+ 6
Here's 2 different ways: System.out.println(); // This will move the console to the next line, without showing any text Place this empty println statement between the hello and world println statements. Or, you can use \n \ is an escape character, using \n in a String will basically do the same thing as an empty println. (Move to the next line) Example/ System.out.println("Hello\n\nWorld!"); Output: Hello World! Note* If I used a single \n the output would be like this: Hello World! Without the extra space.
22nd Aug 2017, 11:14 PM
Rrestoring faith
Rrestoring faith - avatar
0
Thank you!
22nd Aug 2017, 11:20 PM
BVP
BVP - avatar
0
System.out.println("Hello"+ "\n\nWorld!"); This also works if you want to make your code look better!
4th Dec 2017, 3:57 PM
friendly_nadim
friendly_nadim - avatar