day12 this super 在構造方法中的使用

l 引用 l this什麼時候存在的?當創建對象的時候,this存在的 l this的作用:用來區別同名的成員變量與局部變量(this.成員變量) public void setName(String name) { this.name = name; } l 構造方法: 用來給類的成員進行初始化操作 l 格式: 修飾符類名 (參數列表) { ... } l 構造方法的特點: l 1, 方法名與類
相關文章
相關標籤/搜索