package chapter06; public class Student { //1.数据成员 private String name; private String sex; private static String school = "岳麓书院"; //私有静态数据成员 //2.省略构造方法 //3.省略setter和getter方法 //4.功能方法 public void display() { String info = "姓名:" + this.name + ",年龄:" + this.sex; info = info + ",学校:" + Student.school; System.out.println(info); //静态成员方法访问静态数据成员 public static void setSchool (String school){ Student.school = school; } } }