4 回答
孤城少主
TA贡献2条经验 获得超2个赞
class Test{
public static void main(String[] args){
int [] arr = {23,12,45,25,36,45,};
//Demo d = new Demo();
//d.BianLi(arr);
Demo.BianLi(arr);
public class Demo{
private Demo(){}
//遍历数组
public static void BianLi(int [] arr){
System.out.println("[");
for(int i =0;i<arr.length;i++){
if(i==arr.length-1){
System.out.print(arr[i]+"]");
}else{
System.out.print(arr[i]+", ");
}
}
System.out.println();
}
添加回答
举报
0/150
提交
取消