本题主要关键是在于利用matches方法对字符串进行判定是否符合正则判别式的逻辑
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.next();
String emailMatcher="[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+";
//write your code here......
if(str.matches(emailMatcher)){
System.out.println("邮箱格式合法");
}else{
System.out.println("邮箱格式不合法");
}
}
}