简体   繁体   中英

YEAR cannot be resolved to a variable

In JAVA,

Calendar Target_Date = Calendar.getInstance();
Target_Date.set(YEAR,Integer.parseInt(req.getParameter("date").split("-")[0]));

gives error that YEAR cannot be resolved to a variable . Am I not using set() correctly? I want to change Target_Date 's year.

YEAR是静态的,除非您具有静态导入,否则应将其用作Calendar.YEAR

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM