正在加载图片...
大串 South China Agr icultur al University ■数组声明和初始化方法: scores 79 87 int[] scores new int[l0]i scores 94 ■或 int scores[]= new int[10]; 82 或int[] scores= 67 98 79,87,94,82,67,98,87,81,74,91}; 87 使用初始值表就不需要用new运算符。 81 上面的语句执行结果如图1: 74 如果继续对数组 scores初始化: 91 结果如图2: 图2 图16 ◼ 数组声明和初始化方法: ◼ int[] scores = new int[10]; ◼ 或 int scores[] = new int[10]; ◼ 或 int[] scores = {79,87,94,82,67,98,87,81,74,91}; 使用初始值表就不需要用new运算符。 ◼ 上面的语句执行结果如图1: ◼ 如果继续对数组scores初始化: 结果如图2: scores scores 79 87 94 82 67 98 87 81 74 91 图1 图2
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有