赞
踩
- public class ArrayDemo2 {
- public static void main(String[] args) {
- // 数组的索引
- int[] age = {12,22,31};
- // 1.根据索引查找数组元素
- System.out.println(age[0]);
- System.out.println(age[1]);
- System.out.println(age[2]);
-
- }
- }
- public class ArrayDemo2 {
- public static void main(String[] args) {
- // 2.修改数组中的元素
- age[0] = 3;
- age[1] = 5;
- age[2] = 6;
- System.out.println(age[0]);
- System.out.println(age[1]);
- System.out.println(age[2]);
- }
- }
- public class ArrayDemo2 {
- public static void main(String[] args) {
- int[] age = {12,22,31};
- // 数组的长度
- System.out.println(age.length);
- // 非空数组的最大索引 = array.length - 1
- System.out.println(age.length - 1);
- }
- };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。