tihs 关键字
//this關(guān)鍵詞/*調(diào)用類中的屬性
調(diào)用類中的方法或構(gòu)造方法
調(diào)用當(dāng)前對(duì)象,調(diào)用自己的方法,可以省略。
*/
//http://blog.sina.com.cn/s/blog_71f6c1980100wtj4.html//this指當(dāng)前對(duì)象自己public class Google{String s="hello";public Google(String s){System.out.println("1--->s:"+s);//指代全局System.out.println("2--->this.s:"+this.s);//指向類的屬性/方法//this.s=s;//System.out.println("3--->this.s:"+this.s);
}public static void main(String args[]){new Google("hello world");}
}
?
轉(zhuǎn)載于:https://www.cnblogs.com/dengyg200891/p/4829646.html
總結(jié)