//验证邮箱的小程序
import java.util.Scanner;
public class test_Email{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("请输入邮箱的号码");
String s = sc.next();
int i = s.indexOf("@");
int j = s.indexOf(".");
boolean flag = true;
if (i == -1||j == -1){
flag = false;
}
if (flag){
System.out.println("邮箱输入正确");
}else{
System.out.println("邮箱输入错误");
}
}
} |
|