一、代码展示:
/*
* Copyright (c) 2020, 2023, webrx.cn All rights reserved.
*
*/
package com.it;
/**
* <p>Project: chat - Ex04</p>
* <p>Powered by webrx On 2023-07-06 21:07:36</p>
* <p>描述:<p>
*
* @author 简单遗忘 [814736551@qq.com]
* @version 1.0
* @since 17
*/
public class Ex04 {
public static void main(String[] args) {
//定义一个一维数组,并用forech语句遍历该数组
int []arr={12,13,4,7};
System.out.println("一维数组的元素分别为:");
for(int x:arr){
System.out.println(x);
}
}
}
二、运行截图