123A234算不算可以呢?如果一定要是全数字的话可以
try {
    Integer.parseInt(line);
}catch(NumberFormatException) {
   //不是全数字
}

解决方案 »

  1.   

    public class ReadDoubleTest 
       // shows how to read a double the hard way
    {  public static void main(String[] args) 
       {  System.out.println
             ("Enter a number, I'll add two to it.");
          double x; // the number we wish to read
          try
          {  InputStreamReader isr 
                = new InputStreamReader(System.in);
             BufferedReader br 
                = new BufferedReader(isr);
             String s = br.readLine(); 
             DecimalFormat df = new DecimalFormat();
             Number n = df.parse(s);
             x = n.doubleValue();
          }
          catch(IOException e)
          {  x = 0;
          }
          catch(ParseException e)
          {  x = 0;
          }
          System.out.println(x + 2); 
       }
    }   
      

  2.   

    thanks ChDw(米) 
    try {
       Integer.parseInt(line);
       }
       catch(NumberFormatException e ) {
    //不是全数字
    }you are right