垃圾java实验 没ftp没排面

Login.java

import java.util.Scanner;

public class Login {
public static void main(String[] args) {
int success=0;
String namein;
String passwordin;
System.out.println(“请输入您要创建的账号:”);

Scanner sc=new Scanner(System.in);
namein=sc.nextLine();
System.out.println(“请输入您要创建的密码(仅限四到六位纯数字):”);
while(success==0){

Scanner sc1=new Scanner(System.in);
passwordin=sc1.nextLine();
try{
User user1=new User(namein,passwordin);
user1.Judge(passwordin);
success=1;
}
catch(PasswordFormatException e){
System.out.println(e.excepMesagge().toString());
success=0;
}
//test=1;
}
System.out.println(“创建成功!”);

return ;

}

}

User.java

public class User {
public String name;
public String password;
public User(String namein,String passwordin) {
name=namein;
password=passwordin;

}
public void Judge(String passwordin) throws PasswordFormatException{
if(password.length()<5||password.length()>6){
throw new PasswordFormatException();
}
else{
for(int i=0;i‘9’){
throw new PasswordFormatException();
//break;
}

}
}
}
}
PasswordFormatException.java

class PasswordFormatException extends Exception{
public String excepMesagge(){
String str=”密码仅由六至四位纯数字组成,请输入正确的密码:”;
return str;
}
//System.out.println(this.excepMessagge().toString());

}