标签:for main ati ++ array int class i++ public
//数组使用
public class ArrayDemo03 {
public static void main(String[] args) {
int[] arrays = {1,2,3,4,5};
for (int i = 0; i <arrays.length ; i++) {
System.out.println(arrays[i]);
}
System.out.println("=======================");
//求和
int sum = 0;
for (int i = 0; i <arrays.length ; i++) {
sum +=arrays[1];
}
System.out.println(sum);
System.out.println("=======================");
//求最大的元素
int max = 0;
for (int i = 0; i <arrays.length ; i++) {
if (arrays[i]>max){
max = arrays[i];
}
}
System.out.println("max="+max);
}
}
标签:for main ati ++ array int class i++ public
原文地址:https://www.cnblogs.com/XiaoWubeginning/p/14092117.html