没这么简单,java.sun.com上有标准的例程,如果需要的话,可以帮你找找。

解决方案 »

  1.   

    找到了!我自己的EMIAL校验就是参照SUN下面的例子做的。Email Validation The following code is a sample of some characters you can check are in an email address, or should not be in an email address. It is not a complete email validation program that checks for all possible email scenarios, but can be added to as needed. 
    /*
    * Checks for invalid characters
    * in email addresses
    */
    public class EmailValidation {
       public static void main(String[] args) 
                                     throws Exception {
                                     
          String input = "@sun.com";
          //Checks for email addresses starting with
          //inappropriate symbols like dots or @ signs.
          Pattern p = Pattern.compile("^\\.|^\\@");
          Matcher m = p.matcher(input);
          if (m.find())
             System.err.println("Email addresses don't start" +
                                " with dots or @ signs.");
          //Checks for email addresses that start with
          //www. and prints a message if it does.
          p = Pattern.compile("^www\\.");
          m = p.matcher(input);
          if (m.find()) {
            System.out.println("Email addresses don't start" +
                    " with \"www.\", only web pages do.");
          }
          p = Pattern.compile("[^A-Za-z0-9\\.\\@_\\-~#]+");
          m = p.matcher(input);
          StringBuffer sb = new StringBuffer();
          boolean result = m.find();
          boolean deletedIllegalChars = false;      while(result) {
             deletedIllegalChars = true;
             m.appendReplacement(sb, "");
             result = m.find();
          }      // Add the last segment of input to the new String
          m.appendTail(sb);      input = sb.toString();      if (deletedIllegalChars) {
             System.out.println("It contained incorrect characters" +
                               " , such as spaces or commas.");
          }
       }
    }
      

  2.   

    此帖里有你想要的判断email的格式的方法。
    http://www.csdn.net/expert/topic/654/654432.xml?temp=.3112146
      

  3.   

    我给你个简单的:
     public boolean isEmail(String email){
        int pos;
        pos=email.indexOf('@');
        if (pos==-1)
           return false;
        else{
           pos=email.indexOf('.');
           if (pos==-1)
              return false;
           else
              return true;
        }
      }