把test.java救回来了
This commit is contained in:
+27
-27
@@ -1,27 +1,27 @@
|
||||
//Main.java
|
||||
package task2;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
Date inDate = new Date();
|
||||
SimpleDateFormat inFormat = new SimpleDateFormat("yyyy年M月d日", Locale.CHINA);
|
||||
System.out.print("请输入您家孩子的出生日期(格式为yyyy年M月d日):");
|
||||
try {
|
||||
inDate = inFormat.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long inTimeStamp = inDate.getTime();
|
||||
long outTimeStamp = inTimeStamp + (long) 100 * 24 * 60 * 60 * 1000;
|
||||
Date outDate = new Date(outTimeStamp);
|
||||
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy年M月dd日 EEEE", Locale.CHINA);
|
||||
System.out.println("经计算,您家孩子的百日宴应该设在" + outFormat.format(outDate));
|
||||
}
|
||||
}
|
||||
//Main.java
|
||||
package task2;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
Date inDate = new Date();
|
||||
SimpleDateFormat inFormat = new SimpleDateFormat("yyyy年M月d日", Locale.CHINA);
|
||||
System.out.print("请输入您家孩子的出生日期(格式为yyyy年M月d日):");
|
||||
try {
|
||||
inDate = inFormat.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long inTimeStamp = inDate.getTime();
|
||||
long outTimeStamp = inTimeStamp + (long) 100 * 24 * 60 * 60 * 1000;
|
||||
Date outDate = new Date(outTimeStamp);
|
||||
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy年M月dd日 EEEE", Locale.CHINA);
|
||||
System.out.println("经计算,您家孩子的百日宴应该设在" + outFormat.format(outDate));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user