package com.gouzao;
public class Person2 {
String name;
int age;
double hight;
double weight;
public Person2() {
}
public Person2(String name,int age,double hight) {
this(name,age);
this.hight = hight;
}
public Person2(String name,int age) {
this.name = name;
this.age = age;
}
}
/*(1)this指的是你正在构建的对象或你正在使用的对象
*
*(2)this可以修饰属性:
* 总结:当属性名字和形参发生重名的时候,或者属性名字和局部变量重名的时候,都会发生就近原则,
* 所以·我要睡直接使用变量名字的话就指的是离的近的那个形参或者局部变量,这是如果我想要表示属性的话,
* 在前面要加上this.修饰
* 如果不发生重名的话,实际上你要是访问属性也可以省略this
*
*(3)this可以修饰方法
* 总结:仔同一个类中方法可以互相调用,this.可以省略不写
*
*(4) this可以修饰构造器:
* 总结:同一个类中的构造器可以相互用this调用,注意:this修饰构造器必须放在第一行
*/