Java carriage to previous line

Sergey picture Sergey · Nov 11, 2011 · Viewed 14.7k times · Source

\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?

Answer

madth3 picture madth3 · Nov 11, 2011

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.