日期:2014-05-20 浏览次数:21151 次
import java.util.Scanner;
public class Zhuce {
Scanner input = new Scanner(System.in);
public void zhuce() {
System.out.println("请输入账号");
String s = input.next();
boolean b = false;
boolean c = false;
if (s.equals("china") || s.equals("中国") || s.equals("共产党")) {
System.out.println("您的账号无效");
System.out.println("是否继续 Y/N?");
String j = input.next();
if (j.equals("y")) {
zhuce();
} else {
System.out.println("您退出了注册");
}
} else {
if (s.indexOf('@') != -1 && s.indexOf('.') > s.indexOf('@')) {
b = true;
} else {
System.out.println("您的账号无效");
System.out.println("是否继续 Y/N?");
String i = input.next();
if (i.equals("y")) {
zhuce();
} else {
System.out.println("您退出了注册");
}
}
}
System.out.println("请输入密码");
String m = input.next();
System.out.println("请再次输入密码");
String n = input.next();
if (m.equals(n) && m.length() <= 16 && m.length() >= 8) {
c = true;
} else {
System.out.println("您输入的密码有错");
System.out.println("是否继续 Y/N?");
String k = input.next();
if (k.equals("y")) {
zhuce();
} else {
System.out.println("您退出了注册");
}
}
if (b && c) {
System.out.println("注册成功");
}
}
public static void main(String[] args) {
Zhuce z=new Zhuce();
z.zhuce();
}
}