输入:
public class JudgeEmail { public static void main(String[] args) { //定义要匹配的Email地址的正则表达式 String regex="//w+@//w+(//.//w+)+"; String str1="aaa@"; String str2="123456789@QQ.com"; String str3="111@aabbcc.com.cn"; String str4="mnimh@hhhh.etc.cn"; if (str1.matches(regex)) System.out.PRintln("1"); if (str2.matches(regex)) System.out.println("2"); if (str3.matches(regex)) System.out.println("3"); if (str4.matches(regex)) System.out.println("4"); }}输出:
新闻热点
疑难解答