does clrscr like in Turbo Pascal
import java.io.*; public class Clrscr { /* obviously, must - get runtime environnenent - execute a shell command, which results in a process - snatch the process' output into a StreamReader - buffer that in BufferedReader - and throw it onto the screen. Use Linux and have fun!! */ public static void clrscr(){ try{ Runtime rt=Runtime.getRuntime(); Process p=rt.exec("clear"); // maybe must change to "cls" InputStream stdout=p.getInputStream(); InputStreamReader isr=new InputStreamReader (stdout); BufferedReader br=new BufferedReader(isr); String line=null; while ((line=br.readLine()) != null) System.out.println(line); }catch (Exception e){ e.printStackTrace(); } } }
public class ClrscrTester { public static void main (String[]args){ System.out.println ("Clrscr Tester, sachverstand2, today"); Clrscr.clrscr(); for (int i=0;i<99;i++){ for (int j=0; j<(int)(Math.random()*9);j++){ System.out.println ("Clrscr Tester, sachverstand2, today"); } Clrscr.clrscr(); } } }