用英文中的“-”作为国家号,区号,号码的区分(以‘#’作为结束的标志)。
=================================================================
split("-")
while(ch != "#"){}把录入的号码进行合法性检测:输入的号码必须是数字,否则提示输入错误,重新输入
============================================================================
正则表达式

解决方案 »

  1.   

    import java.io.*;public class CheckTelNumber{
      
         public static void main(String args){
             boolean b=true;
             String str=args[0];
             String country;
             String area;
             String num;
             while(b){
                if(check(str)){
                   System.out.println(":"+country);
                   System.out.println(":"+area);
                   System.out.println(":"+num);
                   b=false;
                 }
                else{
                   BufferedReader stdin = 
                   new BufferedReader(new InputStreamReade(System.in));
                   System.out.println("Enter a line:");
                   str=stdin.readLine();
                }
            }
         }
         
         public static boolean check(String str){
             //check str is valid number
             //include character return false and out "输入中不能包含字母!";
             //....
         }}功能自己想想,呵呵
      

  2.   

    public   class   TestInput   
      {   
            public   static   void   main(String   args[])   
            {   
          String   str;   
                  InputStreamReader   stdin   =   new   InputStreamReader(System.in);//键盘输入   
                  BufferedReader   bufin   =   new   BufferedReader(stdin);   
                  try   
                  {   
                  System.out.print   ("请输入字符:   ");   
          str   =   bufin.readLine();   
          System.out.println   ("你输入的字符为:   "+str);   
                  }   
                  catch(IOException   E)   
                  {   
                        System.out.println("发生I/O错误!!!");   
                  }   
            }   
      }
    ======================================================
    这是读,你可以加个判断(validate)直到你的validate为true的时候在输出,否则一直等着输入