本帖最后由 玥夜 于 2014-8-3 07:07 编辑
请帮忙解释一下呗 谢谢:lol
- <p> public class test {
- public static void main(String[] args)
- {
- int[] arr= new int[3]; //在堆内存中开辟一个空间
- int[] arr1= new int[] {1,2,3}; //与上面的一样麽,在内存开辟方式上
- int[] arr2= {1,2,3}; //也在在堆内存中开辟一个空间麽,视频上没有说清楚,也查不到
- //希望您能帮忙解说一下,谢谢
- int[][] arr3= new int[3][2]; //在堆内存中开辟几个空间???与下面的方式有什么不同
- int[][] arr4= new int[3][]; //下面这四句话是在对内存中开辟四个空间,
- arr4[0]= new int[2]; //并将一位数组的引用存储到二维数组中,对么
- arr4[1]= new int[3];
- arr4[2]= new int[4];
- }
-
- }</p>
复制代码
|