虚拟化--搭建VCAC手册
2015-08-23 09:15
253 查看
//对非primitive对象数组操作时,初始化要注意 import java.util.*; class ArrayClassobj { static Random rand = new Random(); static int pRand(int mod) { return Math.abs(rand.nextInt())%mod +1; } public static void main(String [] args) { Integer [] a = new Integer[pRand(30)]; prt("length of a = " + a.length); for(int i = 0 ; i < a.length ; i ++){ //如果没有这行代码,数组初始化将没有完成,只是初始化了一个数组句柄 a[i] = new Integer(pRand(500)); prt("a[" + i + "] = " + a[i]); } } static void prt(String s) { System.out.println(s); } }
相关文章推荐
- VM虚拟机有时不能联网的问题
- Caliburn.Micro.DevExpress
- android 向SD卡写入数据
- 检查网络配置信息
- 操作系统 - unix和windows下进程异同
- weblogic启动报<BEA-090782>错误
- 操作系统 - unix和windows下进程异同
- Android 单击listview弹出popupwindow弹出框
- android权限列表
- 自我修复
- 第五周工作总结
- Friend 1719 (数学+技巧+规律)
- This Virtual Machine Is Configured For 64-bit Guest Operating Systems
- Little定律
- javascript中Array()数组函数详解
- C/C++编译器与链接器工作原理
- Activity生命周期解决(有图有真相)
- 线程与多线程的概念
- 什么是:VGA SVGA XGA SXGA
- [NOIP2008]笨小猴