//数组 //1.数组是Java中很重要的一部分,今天对数组进行了大致的了解,Java中的数组和C中数组还是有一定的区别的 //以下是总结的几种方法 public class FirstP1 { public static void main(String[] args) { //第一种创建方法: int[] nums = new int[]{1,5,6,9,7}; //注意:new int[] 括号中不能有数字; //第二种创建方法: int[] a ={1,2,3,4,5}; //此方法使用与C语言中使用较为相似 //第三种创建方法 int b[] = new int[6]; b[1] = 1; b[2] = 2; //其实就相当于创建了一个对象 } }
Java中数组的创建
猜你喜欢
转载自www.cnblogs.com/ouyangbo12/p/12132347.html
今日推荐
周排行