/** * Created by xabcd on 2019/2/13. */ public class java_yiweishuzu {public static void main(String args[]) { int i; int a[]={5,6,8};//声明数组a并赋值 for (i = 0;i<a.length;i++) System.out.print("a{"+i+"}="+a[i]+",\t"); System.out.println("\n数组长度是:"+a.length); } } a{0}=5, a{1}=6, a{2}=8, 数组长度是:3