- /**
- * 数组的三种定义方法
- *
- * 1.数组类型[] 数组名=new 数组类型[数组长度];
- * 2.数组类型[] 数组名={数组0,数组1,数组2,数组3,....};
- * 3.数组类型[] 数组名=new 数组类型[]{数组0,数组1,数组2,...};
- * */
- public class WhatEver {
- public static void main(String[] args) {
- //第一种 例:
- String[] test1 = new String[6];
- test1[0] = "数组0";
- test1[1] = "数组1";
- //第二种 例:
- String[] test2 = {"数组0","数组1","数组2","...."};
- //第三种 例:
- String[] test3 = new String[]{"数组0","数组1","数组2","...."};
- }
- }