Question:
java new line "\n" problem?
2009-12-03 14:56:38 UTC
hi i am a beginner programmer and i was writing a haiku program and i cant seem to go to the new line for a haiku
i type at the top final char newline = "\n"
then System.out.println (fivesyl1 + "\n" + sevensyl1) but it wont compile i get an error reading
')' excepted i added () around the n but it didnt do anything
please help!
Three answers:
gloergeizkool
2009-12-03 15:10:57 UTC
You could use 3 System.out.println's

I don't know if this next idea would work, but println makes a new line to put text on. If you simply use the print command (System.out.print) it may work.
Jack
2009-12-03 15:34:36 UTC
More likely a missing semi colon or closing bracket, Check that all your punctuation is correct then start using an IDE like Eclipse or Netbeans to make your Java programs, they will spot punctuation errors for you automatically. :)
Lie Ryan
2009-12-03 15:09:41 UTC
your problem is not in the newline; show us some parts of the surrounding code. It is very likely you have unbalanced parentheses (you forgot to close the parentheses somewhere in the previous lines).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...