标签:col har this span get system div getname 调用
public class PersonTest { public static void main(String[] args) { Person p = new Person("李老八"); System.out.println("name"+p.getName()); p.setName("轩子巨二兔"); System.out.println("After setting name:" + p.getName()); } } class Person{ private int age; private String name; public Person(int age) { this.age = age; //修饰属性 } public Person(String name,int age) {
this(int age); //修饰构造器 此时调用形参为int age的构造器 this.name = name; //修饰属性 }
public String getName() { return name; }
public void setName(String name) { this.name = name; //修饰属性 }
public void setName(char n){
name = n; //可以省略this
} }
标签:col har this span get system div getname 调用
原文地址:https://www.cnblogs.com/liangfc/p/12173563.html