-2

I have done C++ in the past and to continue with a long line of code I would use the:

\

operator. My compiler does not seem to recognize that in Java (obviously). What command do I use for next line within the code itself, not the output.

Edit: example -

System.out.println("This code os too long to be put in one extremely long line of code so that is why I am asking this question\nThanks!");

Error: 1 error found: File: H:\CISS 110\BarakGasPrice.java [line: 12] Error: String literal is not properly closed by a double-quote

Andrew Spencer
  • 15,164
  • 4
  • 29
  • 48
donkeyKong
  • 13
  • 2
  • 5

1 Answers1

1

Break the string at a sensible spot and concatenate the two strings together.

System.out.println("This code os too long to be put in one extremely long " +
                   "line of code so that is why I am asking this question\nThanks!");
Makoto
  • 104,088
  • 27
  • 192
  • 230