📜  数组索引越界异常 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:10.957000             🧑  作者: Mango

代码示例1
for(i = 1; i <= height.length; i++){
        heightAsString = JOptionPane.showInputDialog("Please Enter The Height Of Person " + i);
        height[i-1] = Double.parseDouble(heightAsString);

        if(height[i-1] > 1.8){
            over18 += 1;
        }

        if(height[i-1] < 1.6){
            under16 += 1;
        }
    }