123456789101112131415161718192021222324 |
- package com.loveCoding.j20250517_java_array;
- /**
- * @author WanJl
- * @version 1.0
- * @title Demo02
- * @description
- * @create 2025/5/17
- */
- public class Demo02 {
- public static void main(String[] args) {
- int arr[]={1,3,6,4,8,4,6,9,1,3};
- //数组是在内存中开辟的连续的内存空间
- //数组中每个元素都对应一个索引值,
- //数组索引值从0开始到数组长度-1结束。
- //获取数组的长度:数组.length
- //使用for循环遍历数组
- for (int i = 0; i < arr.length; i++) {
- System.out.println(arr[i]);
- }
- }
- }
|