似乎是一個毫無意義的帖子的時候,你看標題,但我一直很偵察與沒有運氣的解決方案小時,也許是屏幕致盲我-_-無法找到符號 - 方法參數
不管怎麼說,一個特定類的重載構造函數拋出一個「無法找到符號」編譯器錯誤,我不知道爲什麼。導致我的問題的代碼是這樣的: -
public Student(String fname, String sname, int age, string ID, String avgGradeStr, String projectedGradeStr, String progTitle, int avgGradeInt, int projectedGradeInt, int progID, double attendance)
和錯誤在"int avgGradeInt"
說法起源。
不要用代碼轟炸你,完整的類如下,如果需要,我也可以發佈Person類。
package DoC;
import java.util.*;
class Student extends Person
{
protected String avgGradeStr, projectedGradeStr, progTitle;
protected int avgGradeInt, projectedGradeInt, progID;
protected double attendance;
//CONSTRUCTOR
public Student()
{
fname="Not";
sname="Set";
avgGradeStr="Not Set";
ID="Not Set";
projectedGradeStr="Not Set";
progTitle="Not Set";
avgGradeInt=0;
projectedGradeInt=0;
progID=0;
attendance=0;
}
//CONSTRUCTOR (OVERLOADED)
public Student(String fname, String sname, int age, string ID, String avgGradeStr, String projectedGradeStr, String progTitle, int avgGradeInt, int projectedGradeInt, int progID, double attendance)
{
fname=this.fname;
sname=this.sname;
age=this.age;
ID=this.ID;
avgGradeStr=this.avgGradeStr;
projectedGradeStr=this.projectedGradeStr;
progTitle=this.progTitle;
avgGradeInt=this.avgGradeInt;
projectedGradeInt=this.projectedGradeInt;
progID=this.progID;
attendance=this.attendance;
}
//GETTERS
//get average grade string
protected String getAvgGrade()
{
return avgGradeStr;
}
//get average grade integer
protected int getAvgGradeInt()
{
return avgGradeInt;
}
//get projected grade string
protected String getProjectedGrade()
{
return projectedGradeStr;
}
//get projected grade int
protected int getProjectedGradeInt()
{
return projectedGradeInt;
}
//get attendance
protected double getAttendance()
{
return attendance;
}
//get programme-of-study ID
protected int getProgrammeID()
{
return progID;
}
//get programme-of-study title
protected String getProgrammeTitle()
{
return progTitle;
}
//END GETTERS
//START SETTERS
//set programme id
protected void setProgrammeID(int progID)
{
try{
progID=this.progID;
}
catch(Exception e)
{
System.out.println("setProgrammeID() error: " + e);
}
}
//set programme title
protected void setProgrammeID(String progTitle)
{
try{
progTitle=this.progTitle;
}
catch(Exception e)
{
System.out.println("setProgrammeTitle() error: " + e);
}
}
//set average grade string
protected void setAvgGrade(String avgGradeStr)
{
try{
avgGradeStr=this.avgGradeStr;
}
catch(Exception e)
{
System.out.println("setAvgGrade() error: " +e);
}
}
//set average grade int
protected void setAvgGradeInt(int avgGradeInt)
{
try{
avgGradeInt=this.avgGradeInt;
}
catch(Exception e)
{
System.out.println("setAvgGradeInt() error: " +e);
}
}
//set projectede grade string
protected void setProjectedGrade(String projectedGradeStr)
{
try{
projectedGradeStr=this.projectedGradeStr;
}
catch(Exception e)
{
System.out.println("setProjectedGrade() error: " +e);
}
}
//set projectede grade int
protected void setProjectedGradeInt(int projectedGradeInt)
{
try{
projectedGradeInt=this.projectedGradeInt;
}
catch(Exception e)
{
System.out.println("setProjectedGrade() error: " +e);
}
}
//END SETTERS
} //END CLASS
一如既往,任何幫助非常感謝傢伙!
請注意,您將右側分配給左側。 –
什麼是錯誤信息? – MxyL