Place it in different locations, the code logic is different, it depends on the specific needs
Put it inside the loop and when an exception occurs, if the catch exception does not continue to be thrown, the loop will continue ; If it is placed outside, the loop will be terminated at the location of the first exception
An exception will occur when printing, so it should be inside
Place it in different locations, the code logic is different, it depends on the specific needs
Put it inside the loop and when an exception occurs, if the catch exception does not continue to be thrown, the loop will continue
; If it is placed outside, the loop will be terminated at the location of the first exception
Put it outside the loop, the performance will be better~
You can put it anywhere, but it’s not recommended to put it outside and only try it once, and put it in a loop and try it n times.