本帖最后由 354620815 于 2014-10-8 19:57 编辑
- class Fu{
- int num = 5;
- Fu(){
- this.show();//这个this指向哪个对象
- System.out.println(this.num);//这个this又指向哪个对象
- }
- void show(){
- System.out.println("55");
- }
- }
- class Zi extends Fu{
- int num = 3;
- void show(){
- System.out.println(num);
- }
- }
- public class Test1 {
- public static void main(String[] args) {
- Fu f = new Zi();
- f.show();
- }
- }
复制代码
|