Public static void main (String [] args) throws RegisterException {
//use Scanner input register information
Scanner sc=new Scanner(System.in);
System. The out. Println (" please enter your registered user name: ");
String username=sc. Next ();
CheckName (username);
}
//determine
Public static void checkName (String username) throws RegisterException {
//iterate through group
For (String name: usernames) {
{if (username. Equals (usernames))
Throw new RegisterException (" error ");
}
}
System. The out. Println (" registration ");
}
Zhang SAN, existing in the array are input zhang still show registration, should not interrupt handling after throwing an exception?
CodePudding user response:
Username. Equals (usernames) to the username. Equals (name)CodePudding user response:
I don't know what to say , you don't take the name than walking down group, take the original array, you traverse point?