我试过使用\033[H\033[2J.和System.out.flush((;但到目前为止,运气不佳
/**
* @param args the command line arguments
* @throws java.io.IOException
*/
public static void main(String[] args) throws IOException {
Scanner myObj = new Scanner(System.in);
System.out.println("Hello User,");
System.out.println("Please Enter Username");
String UserName = myObj.nextLine();
System.out.println("Welcome, " + UserName);
System.out.println("Please Enter Your Password");
String Password = myObj.nextLine();
if ("Vaska".equals(Password)){
//Clear Console
System.out.println("You Have Now Gained Access To The Program, Have Fun!");
}else{
//Clear Console
System.out.println("Sorry " + UserName + ", You Have Entered The Wrong Password, Please Restart The Application");
System.exit(0);
}
}
我也尝试过使用System.getProperty((方法,但它总是返回错误。
如果
System.out.print("