tihs 关键字
//this關鍵詞/*調用類中的屬性
調用類中的方法或構造方法
調用當前對象,調用自己的方法,可以省略。
*/
//http://blog.sina.com.cn/s/blog_71f6c1980100wtj4.html//this指當前對象自己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");}
}
?
轉載于:https://www.cnblogs.com/dengyg200891/p/4829646.html
總結