package java01; public class Student { // 1. 定义三个私有属性 private int studentId; private String name; private double score; // 2. 构造方法:名字必须和类名完全一样 public Student(int studentId, String name, double score) { this.studentId = studentId; this.name = name; this.score = score; } // 3. study 方法 public void study() { System.out.println(name + " 正在学习..."); } // 4. Getter 方法(用来获取私有属性的值) public int getStudentId() { return studentId; } public String getName() { return name; } public double getScore() { return score; } }