Files
javaSE-0113/day05/src/com/inmind/array01/Demo03.java

21 lines
710 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.array01;
/*
数组的异常_角标越界异常
ArrayIndexOutOfBoundsException:
数组 索引 越界 异常
注意:数组中长度是固定的,数组的最大索引值,数组长度-1,数组.length - 1就是最大门牌号
0-数组.length - 1的门牌才能正确操作数组否则ArrayIndexOutOfBoundsException
*/
public class Demo03 {
public static void main(String[] args) {
double[] arr = new double[3];
System.out.println(arr);//地址
System.out.println(arr[0]);//0.0
System.out.println(arr[1]);
System.out.println(arr[2]);
System.out.println(arr[3]);
System.out.println(arr[4]);
}
}