📜  java get set - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:27.991000             🧑  作者: Mango

代码示例1
public class Person {
  private String name; // private = restricted access

  // Getter
  public String getName() {
    return name;
  }

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