S
steve747
A coworker of mine has been criticised in a code review for a code similar to
that Iisted below because it 'uses an exception for code flow control'. I
agree with him that its good code because its a reasonable way to check if a
string is/is not an integer, but I wonder if anyone knows of some
authoritative reference to back this up?
....
int i;
try {
i = Integer.parseInt(astringvariable);
} catch (NumberFormatException nfe) {
System.out.prlintln("it isnt an integer");
}
.....
that Iisted below because it 'uses an exception for code flow control'. I
agree with him that its good code because its a reasonable way to check if a
string is/is not an integer, but I wonder if anyone knows of some
authoritative reference to back this up?
....
int i;
try {
i = Integer.parseInt(astringvariable);
} catch (NumberFormatException nfe) {
System.out.prlintln("it isnt an integer");
}
.....