Should try…catch go inside or outside a loop?

后端 未结 21 1954
眼角桃花
眼角桃花 2020-11-30 17:33

I have a loop that looks something like this:

for (int i = 0; i < max; i++) {
    String myString = ...;
    float myNum = Float.parseFloat(myString);
            


        
21条回答
  •  时光说笑
    2020-11-30 17:44

    In your examples there is no functional difference. I find your first example more readable.

提交回复
热议问题