On 10/6/2012 6:55 AM, vikaskumar sharma wrote:
> pls help me.if anyone knows how to clear screen of command prompt in
> java as clrscr() in c language.
>
There is no similar method in Java. Windows has a command "cls" that
causes the DOS window to be cleared. It is an internal command specific
to Windows. Linux has a "clear" command which scrolls the window up to
clear it.
You could duplicate the Linux style clear command easily enough,
although I don't know of any way to determine how many lines the window
has. It may be possible to use Runtime.exec to issue these commands but
I've never been able to get it to work.
You should take a look at the Console class if you are going to do a
terminal based program.
--
Knute Johnson