Write a package called Clear, it contains one public method clrscr() to clear the screen, import the package and use it in another program. code example
Example: java clear console
Runtime.getRuntime().exec("cls");
Runtime.getRuntime().exec("cls");