Re: Can we do this with println?



neelsmail@xxxxxxxxxxxxxx wrote:
In the diagram above as 'X' is any character and the remaining one is
a subscript (01, 02, 03 and so on..). What I want to do then is write
the character to the screen in the subscript order X01, X02 and so
on.. The problem is I do not get how using "System.out.println" I can
go one line above without erasing the whole screen. Of course this is
_not_ a homework but something I am trying to do nevertheless.

In an ANSI-compliant terminal (i.e., pretty much anything other than Window's Command Prompt), the following string, when printed out, will print "XXX" at the top of the screen:

"\u001B[1;1HXXX"

(see <http://en.wikipedia.org/wiki/ANSI_escape_code> for other examples)

--
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
.