Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
Java期末试卷题目整理
题目快速定位:
代码:
public class ScoreTest {
public static void main(String[] args) {
int arr[] = { 56, 91, 78, 67, 56, 87, 45, 62, 82, 63 };
int num = arr.length;
int i = 0;
int sumScore = 0;
int sumNum = 0;
double average;
while (i < num) {
sumScore = sumScore + arr[i];
i++;
}
average = (double) sumScore / num;
i = 0;
do {
if (arr[i] < average)
sumNum++;
i++;
} while (i < num);
System.out.println("average:" + average + ",belows average:" + sumNum);
}
}
代码:
class Person {
String name;
int age;
char sex;
public Person(String name,int age,char sex){
this.name=name;
this.age=age;
this.sex=sex;
}
void eat(){}
}
class Student extends Person {
String school;
Student(String name, int age, char sex, String school) {// 带参构造方法,为成员变量赋值
super(name, age, sex);
this.school = school;
}
}
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">
<img src="" width="77%">