Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

clearing the previous content in the console

Hi All,

when I was comparing java with C,.. i had one doubt. i.e., Does Java have any method to clear the previous content in the console.. from java program itself.. like C having "clrscr()"...
if anybody knows.. plz let me know..

Thanks in advance...

GuruSireesha M
[302 byte] By [gurusirisha] at [2007-11-11 7:50:47]
# 1 Re: clearing the previous content in the console
That would be completely console-dependent. Some consoles will be cleared with a formfeed (char 12). Others maybe with a DOS EOF (char 26). Other consoles may not be clearable at all. Others may take out-of-band signals like method calls to their container, or any number of other ways. Perhaps if you know what terminal type the output is going to you could send the appropriate clear-screen codes. But there's no way that I know of to be sure where the System.out is sending its data.

Unless your code has special knowledge about the console your System.out (and System.err) will be printing to, your only tool is the PrintStream interface, and all it does is take print data.
Laszlo at 2007-11-11 22:37:10 >
# 2 Re: clearing the previous content in the console
Why would you need to do this anyway?
destin at 2007-11-11 22:38:10 >