Parse a number
Java Exceptions
try / catch
Flowchart (ISO 5807)
Source code
class P {
static int parse(String s) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return -1;
}
}
} try / catch
class P {
static int parse(String s) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return -1;
}
}
}