this关键字
没使用this关键字
package com.imooc;
//import com.imooc.second.people;
public class packAge {
private int Eyes;
private int nose;
private int ears;
public static void main(String[] args){
packAge hello = new packAge();
hello.seteyes(5);
int aa= hello.geteyes();
System.out.println("Eyes:"+aa);
}
public int geteyes(){
return Eyes;
}
public void seteyes(int Eyes){
Eyes=Eyes;
}
}
运行结果:
Eyes:0
使用this关键字
this. Eyes=Eyes;
运行结果:
Eyes:5
我想请问出现0的情况是怎么回事?