For Java
You can try
boolean isVarAnInt = false
try {
Integer temp = new Integer(variableName);
if (temp.intValue() > 0 || temp.intValue() < 0 || temp.intValue() == 0) {
System.out.println("Input Variable Is An Integer");
isVarAnInt = true;
}
} catch (NumberFormatException err) {
System.out.println("Input Variable Is Not An Integer");
}
I haven't compiled the above code. So, there might be some small syntax issues that you might need to fix using ur IDE.
Last edited by nehaandrew; 11-26-2008 at 09:46 AM.
|