這是我的代碼。當我使用bluej進行編譯時,它突出顯示了最後一個}並且缺少返回語句。我不能把void作爲布爾值。有任何想法嗎?缺少退貨聲明?
public boolean runAJob() {
boolean jobsFinished = false;
Job firstJob = getCurrentJob();
String jobName = firstJob.getName();
int jobDuration = firstJob.getDuration();
if (!myJob.isEmpty()&& jobDuration > 0 && jobDuration <= myTotalDuration) {
myTotalDuration -= jobDuration;
myFinishedJobs.add(myJob.get(0));
myJob.remove(0);
System.out.println("'"+jobName+"'" +" is completed. "+ myTotalDuration+ " seconds remaining on the clock");
jobsFinished = true;
} else {
System.out.println("JobQueue is empty");
}
}
是什麼把回報jobsFinished的問題; –