F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_29437657_15149\Main.java:1: 错误: 解析时已到达文件结尾
package com.date.test;  import java.text.ParseException;  import java.text.SimpleDateFormat;  import java.util.Date;  public class Test { public static void main(String[] args) throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // 日期格式 Date date = dateFormat.parse("2015-07-31"); // 指定日期 Date newDate = addDate(date, 20); // 指定日期加上20天 System.out.println(dateFormat.format(date));// 输出格式化后的日期 System.out.println(dateFormat.format(newDate)); } public static Date addDate(Date date,long day) throws ParseException {  long time = date.getTime(); // 得到指定日期的毫秒数  day = day*24*60*60*1000; // 要加上的天数转换成毫秒数  time+=day; // 相加得到新的毫秒数  return new Date(time); // 将毫秒数转换成日期 }  } 
                                                                                                                                                                                                                                                                          ^
1 个错误


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 08:38:41, Gzip enabled