1、看来主要是你的基本功不太过关。
2、拿这段测试代码试下看吧,希望通过这个,你能分析出自己代码段的问题。package test;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SpecialTest {
public static void computeMovingAverage(String fromDate, String toDate)
throws Exception {
int i;
Date fDate = new Date();
Date tDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
fDate = sdf.parse(fromDate);
System.out.println("fDate---" + fDate);
tDate = sdf.parse(toDate);
System.out.println("toDate---" + tDate);
}
public static void main(String[] args) throws Exception {
computeMovingAverage("08/15/2004", "09/15/2004");
}
}