首先创建一个类里面写好我们的私有化 public class Student { // 成员变量私有化 private String name; private int age; 然后有个快捷需要下载一个插件ptg可以一键帮我们生成