文章标题

来源:互联网 发布:站长工具端口 编辑:程序博客网 时间:2024/05/01 12:43

package com.bb;

/**
* @author Administrator
*使用循环操作Java数组
*/
public class Demo7 {
public static void main(String[] args) {
int[] scores={1,2,3,4,4,5,43,66,7};
for (int i = 0; i < scores.length; i++) {
System.out.println(“数组中第”+(i+1)+”个元素是:”+scores[i]);
// System.out.println(scores[12]); 数组越界
}
String[] hh={“aa”,”dd”,”ddd”,”sss”,”eee”};
for (int i = 0; i < hh.length; i++) {
System.out.println(hh[i]);
}

}
}

0 0
原创粉丝点击