Java variable defined inside a loop doesn't seem to be recognized outside the loop?

后端 未结 4 1281
北荒
北荒 2021-01-20 10:54

I have a section of code that is puzzling me. I define an integer array inside an if/else statement because the length of the array depends on the length of 2 inputs to the

4条回答
  •  伪装坚强ぢ
    2021-01-20 11:19

    Scope of a variable is always the next enclosing { }.

    Of cause starting at its declaration (not at the {)

提交回复
热议问题