I want the program to wipe out the previous console output. For example i have a data entry program that when the program repeats, the whole output that were inputted must be wiped away in the console for privacy (for instance, if someone you don't know is using the program again and you don't want them to see what you've inputted in the console before). By the way I am using Java in eclipse and I wonder if this thing would be possible.
String aWord;
String repeat;
do {
Scanner scan = new Scanner(System.in);
System.out.println("Type anything.");
aWord = scan.nextLine();
System.out.println("Do you want to type anything again? Y/N");
repeat = scan.nextLine();
while(!repeat.equalsIgnoreCase("y") && !repeat.equalsIgnoreCase("n")) {
System.out.println("[ERROR] Please answer correctly.");
repeat = scan.nextLine();
if (repeat.equalsIgnoreCase("n")) {
System.out.println("Thanks for using this program!");
System.exit(0);
}
}
if (repeat.equalsIgnoreCase("n")) {
System.out.println("Thanks for using this program!");
System.exit(0);
}
}while (repeat.equalsIgnoreCase("y"));
// if the user answers yes, the program must repeat the whole process.
// if the user answers yes, the program must wipe out all previous output in the console.