标签:
用法:
public class Test2{ String name; String age; public void atc(String name2,String age2){ this.name = name2; //this.name是访问属性name,这句代表给属性name赋值 this.age = age2; } public static void main(String[] args){ Test2 Myclass = new Test2(); Myclass.atc("小红","17"); System.out.println(Myclass.name); System.out.println(Myclass.age); } }
运行结果:
标签:
原文地址:http://www.cnblogs.com/phpyangbo/p/java-this.html