public class Demo1{ public static void main(String[] args) { //1 int[] array = new int[3]; System.out.println(array[0]);//0 array[0] = 1; array[1] = 2; array[2] = 3; System.out.println(array[2]); //2 int[] array1 = new int[]{1,2,3}; //3 int[] array2 = {1,2,3}; System.out.println(array2.length);//3 /* String str=""; System.out.println(str);*/ System.out.println("*************"); for (int i=0;i<array2.length;i++) { System.out.println(array2[i]); } for (int i=array2.length-1;i>=0;i--) { System.out.println(array2[i]); } System.out.println(array2[1]); //for-each 增强for循环 for(int num:array2){ System.out.println(num); } } }