javacarriage-return

Java carriage to previous line


\n - is a new line in java, is it possible to get to the previous line from the current position? For example, I want to print "this is for test"

System.out.println("this is for");

Now how can I append "test" to the previous line since println moved carriage to the next?


Solution

  • I don't think you can.

    You would normally use System.out.print for the first part instead and use a println() or a '\n' once you're sure your line ended.