其他分享
首页 > 其他分享> > 封装

封装

作者:互联网

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;
  }
}

 

标签:封装,String,oop,demo4,Student,public,name
来源: https://www.cnblogs.com/Gc-mosi/p/15377386.html