我试图创建一个程序,但我得到一些我无法消除的错误。请有人帮我一把吗?
import java.util.Scanner;
class julianDate {
long year;
long month;
long day;
long EPOCHYEAR;
julianDate() {
}
long returnJulianEpochDays(long year, long month, long day){
long yearCounter = EPOCHYEAR;
long total = 0;
while (yearCounter < year){
total += returnDaysInYear(yearCounter);
yearCounter += 1;
}
total += returnJulianDate(long year, long month, long day);
return total;
}
}
public class julianDateNew {
}
错误:
这些是我编译程序时遇到的错误:
/Users/NetBeansProjects/JavaApplication1/src/julianDateNew.java:25: '.class' expected
total += returnJulianDate(long year, long month, long day);
/Users/NetBeansProjects/JavaApplication1/src/julianDateNew.java:25: ';' expected
total += returnJulianDate(long year, long month, long day);
/Users/vlopezlama/NetBeansProjects/JavaApplication1/src/julianDateNew.java:25: <identifier> expected
total += returnJulianDate(long year, long month, long day);
/Users/NetBeansProjects/JavaApplication1/src/julianDateNew.java:25: not a statement
total += returnJulianDate(long year, long month, long day);
/Users/etBeansProjects/JavaApplication1/src/julianDateNew.java:25: ';' expected
total += returnJulianDate(long year, long month, long day);
答案 0 :(得分:1)
这个声明没有意义:
total += returnJulianDate(long year, long month, long day);
由于您正在对returnJulianDate
进行方法调用,因此您只想传递声明为该类型的变量:
total += returnJulianDate(year, month, day);
现在,如果方法returnJulianDate
不存在,那么你还有另一个需要解决的问题。