1.定义不规则二维数组:int [][] a=new int [3][];
a[0]=new int [10];
a[1]=new int [3];
a[2]=new int [4];
PS:int [][] a=new int [][3];这种格式是错误的
2.定义一维数组的集中常用格式:
(1)int a []=new int [5];
(2)int a []={1,2,3,4,5};
(3)int a []=new int [] {1,2,3,4,5};
3.增强for循环foreach中第一个值代表集合中的元素,第二个代表集合(如下图实例)
4.Math.random()方法来产生一个随机数,这个产生的随机数是0-1之间的一个double,本菜鸟刚才一直纳闷int s=(int) (Math.random());结果为啥一直是0,刚才知道原来是它产生的是0-1double的随机数,用int向下取整可不都是0嘛。
5.我们的System类中有一个currentTimeMillis()方法,这个方法返回一个从1970年1月1号0点0分0秒到目前的一个毫秒数,返回类型是long