21 lines
710 B
Java
21 lines
710 B
Java
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]);
|
||
}
|
||
}
|