1.else if 循环结构
编写一个成绩和判定等级的程序:
public class ScoreAndGrade {
public static void main(String[] args) {
double score = 82;
if(score>80){
System.out.println("great!");
}
else if(score>70){
System.out.println("good");
}
else if(score>60){
System.out.println("ok");
}
else{
System.out.println("bad");
}
}
}
2.数组中的for循环
public class ShuzuXunhuan {
public static void main(String[] args) {
int[] a = new int[100]; //创建和声明数组
for (int i=0;i < 100;i++)
a[i] = i; //数组赋值的过程
for (int i=0;i < a.length;i++)
System.out.println(a[i]); //数组读取和打印
}
}
3.数组拷贝