使用
try{
  Integer.parseInt(your value);
}catch (Exception E){
  System.Out.println("--- 不是数字!--");
}

解决方案 »

  1.   

    String IntValue = "222";
      boolean isInt = false;
      try{
        int v = Integer.parseInt(IntValue);
        isInt = true;
      }catch(Exception e){
        System.out.println("对不起,不是数字");
      }
      

  2.   

    try:    public boolean validate(String id) {       boolean result = true;
           for (int i = 0; i < id.length(); i++) {
             if (Character.isDigit(id.charAt(i)) == false)
                result = false;
           }
           return result;
        }