我收到以下錯誤消息從我的代碼,Java作業類構造函數中的錯誤消息。請幫助
找不到符號 - 變量作業名
我們必須創建兩個簡單場作業名稱和作業長一類叫做工作。
我不明白爲什麼我會收到此錯誤消息。代碼如下。提前感謝您的幫助。
import java.util.ArrayList;
public class Job
{
// instance variables - replace the example below with your own
private String name;
private int duration;
private boolean isComplete;
/**
* Constructor for objects of class Job
*/
public Job(String name, int duration)
{
// initialise instance variables
jobName = name;
jobDuration = duration;
}
/**
* Accessor method for job name.
*
* @param y a sample parameter for a method
* @return value of job.
*/
public String getName() {
{
// put your code here
return jobName;
}
}
/**
* Accessor method for job duration.
*
* @param y a sample parameter for a method
* @return value of job duration.
*
*/
public int getDuration() {
{
return jobDuration;
}
}
/**
* Run method which prints.
*
* @param y a sample parameter for a method.
* @return
*/
public void run(String name, int duration) {
if (isComplete)
{
System.out.print("JOB COMPLETE" + jobName);
}
}
}
請接受其中一個答案作爲您的問題的答案和upvote如果它幫助你。當有人投入時間幫助你時,這是最不可能的。你已經提出了六個問題並收到了答案,但從未接受過其中一個。 – MarchingHome