Java SE——面向對象 static關鍵字的用法

static修飾屬性和方法 static變量 —— 類屬性(靜態屬性) class Dog{ String talk = "汪汪"; String name; int age; public void getInfo(){ System.out.println("姓名:"+this.name+",年齡:"+this.age+",叫聲:"+this.t
相關文章
相關標籤/搜索