/*判断整形数据,先编译,在测试。
javac TestNum.java
编译通过
java TestNum [你要测试的串]
如:java TestNum 8o00
则提示:Your string IS NOT NUMBER!
*/
public final class TestNum
{
public static boolean convertInt(String str)
{
try
{
int n = Integer.parseInt(str);
return true;
}
catch(NumberFormatException e)
{
//e.printStackTrace();
return false;
}
}
public static void main(String[] args)
{
if (args.length != 1)
{
System.out.println("Please input a STRING that you would test!");
}
else
{
String aa=args[0];
boolean bln = convertInt(aa);
if (bln==true)
{
System.out.println("Your string IS NUMBER!");
}
else 
{
System.out.println("Your string IS NOT NUMBER!");
}
}
}

}