• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About I/O

 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we clear the monitor screen.....like we do in C or C++ prg using clrscr(); ?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There really isn't a pure Java equivalent to this. I find it rare that I need to do such a thing in much of my programming anyway. Why do you need to do this?

Layne
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Layne Lund:
There really isn't a pure Java equivalent to this. I find it rare that I need to do such a thing in much of my programming anyway. Why do you need to do this?

Layne


Simply!......just as i use to do in my C/C++ prgs....generally while working with prgs....i need the screen to be cleared which usually is cluttered with diffrent outputs....especially when i am testing my prg for diferent input values....thats why!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are saying that you need to do this for a visual clue that something new has happened? You can provide the same visual clue by inserting blank lines at appropriate places. A quick and dirty way to "clear the screen" is to just print out 60 blank lines in a row.

Layne
 
shank ram
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include this method in your code and call clrscr():

private static void clrscr() {
for (int i=0; i<=60; i++) {
System.out.println();
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic