this關鍵字

當成員變量和局部變量重名,可以用關鍵字this來區分。 簡單來說,哪個對象調用了this所在的函數,this就代表哪個對象。 class Person { private String name; private int age; Person2(String name) { this.name = name; } public
相關文章
相關標籤/搜索