1
我目前工作的一個模塊類與幾個學生對象,並已遇到了以下問題 -不好操作數類型字符串元運算符「+」
不好操作數類型字符串元運算符「+」
我將不勝感激任何幫助,我的代碼如下。
public class Module {
private String moduleTitle;
int percentageCoursework;
int percentageExam;
private Student studentsList[] = new Student[3];
public Module (String moduleTitle, int percentageCoursework, int percentageExam,String studentOne, String studentTwo, String studentThree, String studentsTitles[])
{
this.moduleTitle = moduleTitle;
this.percentageCoursework = percentageCoursework;
this.percentageExam = percentageExam;
this.studentsList[0].name = studentOne;
this.studentsList[1].name = studentTwo;
this.studentsList[2].name = studentThree;
}
public void ShowDetails()
{
System.out.println("moduleTitle : " + moduleTitle +
"\n percentageCoursework : " + percentageCoursework +
"\n percentageExam : " + percentageExam +
+studentsList[0].name+studentsList[1].name+studentsList[2].name);
}
}
非常感謝! – user2343208 2013-05-03 07:56:03