封装

package oop.demo4;

import oop.demo4.Student;

public class Demo4 {
  public static void main(String[] args) {
      Student student=new Student();
      student.getName();
  }
}
package oop.demo4;

public class Student {
  private String name;

  public String getName() {
      return name;
  }

  public void setName(String name) {
      this.name = name;
  }
}

 

上一篇:Java job interview:AOP面向切面编程案例分析


下一篇:POP与OOP