, .
if you plan to continue the iteration when some kind of exception occurs, naturally you insert a catch try block.
if you want to stop the operation when some kind of error occurs best, you need to put catch try in the block.
for (int i = 0; i < 10000000; i++) {
try {
}catch (Exception e) {
}
}
Duration 16 ms.
try {
for (int i = 0; i < 10000000; i++) {
}
}catch (Exception e) {
}
Duration 0ms.
source
share