0

Guys why it isn't working

Link : https://code.sololearn.com/cgWS7doGFYOS/?ref=app Output : "Olá,Mundo!Olá Java"

29th May 2021, 11:16 AM
Katdotbrush
Katdotbrush - avatar
6 Respostas
+ 2
public class Program { public static void main(String[] args) { System.out.print("Olá,Mundo!"); System.out.println("\nOlá Java"); } } Cat Raspberry 🥧 do this
29th May 2021, 11:21 AM
Atul [Inactive]
+ 2
Print will print it in same line. And println will print it in same line and then take the cursor down
29th May 2021, 11:22 AM
Atul [Inactive]
+ 1
It's working fine tell your excepted output
29th May 2021, 11:18 AM
Atul [Inactive]
+ 1
System.out.println() adds new line after output.. while System.out.print method does not add new line... edit: see differences , from search bar: https://www.sololearn.com/discuss/1317561/?ref=app https://www.sololearn.com/discuss/1515132/?ref=app
29th May 2021, 11:27 AM
Jayakrishna 🇮🇳
+ 1
Cat Raspberry 🥧 .print() don't do a line break .print("hello"); .print("test"); -> on same line .println("another test"); -> still on same line but the next statement will be printed on the next line .println("next"); So in your case: .print("Olá,Mundo!"); .println() //for line break .println("Olá Java"); or much easier: just use println() if you want to print everything on a new line.
29th May 2021, 11:34 AM
Denise Roßberg
Denise Roßberg - avatar
0
Atul Output that i want : Olá,Mundo! Olá Java But he printed just in the first line
29th May 2021, 11:20 AM
Katdotbrush
Katdotbrush - avatar