import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class CurrentDate {
CurrentDate(){}
private String crtDate=""; SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-mm-dd");
Date today=new Date();
crtDate=dateFormat.format(today);
}
这段代码有错吗?eclipse报错说Syntax error on token";",,expected
import java.util.Date;
/**
*
*/
public class CurrentDate {
CurrentDate(){}
private String crtDate=""; SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-mm-dd");
Date today=new Date();
crtDate=dateFormat.format(today);
}
这段代码有错吗?eclipse报错说Syntax error on token";",,expected
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class CurrentDate {
CurrentDate(){}
private String crtDate="";
{
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-mm-dd");
Date today=new Date();
crtDate=dateFormat.format(today);
}
}
--> yyyy-MM-dd
MM长大了!