爲什麼它擴展了學校班級給我一個錯誤被創建時,一個新的對象,並在構造函數被調用,並通過參數的正確量用正確的數據類型的年級到構造函數?錯誤的Java擴展一個類時,SE 6
我得到使用Java SE NetBeans中的以下警告6
找不到符號:Constuctor學校();
package school;
public class School {
String name;
String location;
int pupils;
School(String name, String location, int pupils) {
this.name = name;
this.location = location;
this.pupils = pupils;
}
}
package school;
public class Grade extends School {
School school = new School("Your Schools Name", "Your schools Location", 1700);
}
在什麼地球不會甲級延長學校? – Joost 2012-01-13 13:50:13
你也可能想讓'School'構造函數爲'public'。 – Viruzzo 2012-01-13 13:55:03