我不完全明白我在做什麼以及我做錯了什麼。 請幫我修復/確定我的代碼。 我應該創建至少3個Student對象,其中包含您選擇的輸入數據,以使用類的構造函數初始化Student對象的所有數據字段。 聲明一個ArrayList對象來保存Student對象。 將Student對象添加到ArrayList對象。 調用Student類的toString方法以使用ArrayList對象中的Student對象打印學生的全名,後跟出生日期和每個學生的地址。驅動程序代碼:需要幫助/指導
正如你所看到的,即使有大量的研究,我也不知道如何解決這個問題。我仍然處於初級水平。
import java.util.ArrayList;
public class PersonDriver {
public static void main(String[] args) {
Person toString = new Person();
Person middleInitial = new Person();
Person lastName = new Person();
ArrayList<String> studentList = new ArrayList<String>();
studentList.add(new String("John", "Cassy"));
studentList.add(new String("Jessie", "Lucy"));
for (String student : studentList) {
System.out.println(student); }
}
} //end PersonDriver class
這是上面的驅動程序類的原代碼:Constructor requiring more than one for subclass super
你到底在做什麼? – George
你不應該爲此打開一個新問題。你不能在你之前的問題中問過嗎? – Leo
我認爲這個問題應該被遷移到http://codereview.stackexchange.com/ – Barranka