```java public class Student { private int id; private String name; private double chineseScore; private double mathScore; private static int studentCount = 0; public Student(int id, String name, double chineseScore, double mathScore) { this.id = id; this.name = name; this.chineseScore = chineseScore; this.mathScore = mathScore; studentCount++; } public double getTotalScore() { return chineseScore + mathScore; } public double getAverageScore() { return (chineseScore + mathScore) / 2; } public static void printStudentCount() { System.out.println("当前学生总数为:" + studentCount); } public void printStudentInfo() { System.out.println("姓名:" + name); System.out.println("学号:" + id); System.out.println("总成绩:" + getTotalScore()); System.out.println("平均成绩:" + getAverageScore()); System.out.println("----------------------------------"); } public static void main(String[] args) { Student student1 = new Student(1, "张三", 85, 90); Student student2 = new Student(2, "李四", 78, 88); student1.printStudentInfo(); student2.printStudentInfo(); Student.printStudentCount(); } } ``` 运行结果: ``` 姓名:张三 学号:1 总成绩:175.0 平均成绩:87.5 ---------------------------------- 姓名:李四 学号:2 总成绩:166.0 平均成绩:83.0 ---------------------------------- 当前学生总数为:2 ``` [2024-09-29 16:14:21 | AI写代码神器 | 1026点数解答]