本帖最后由 yu2008jiang 于 2015-9-2 10:00 编辑
- importjava.text.ParseException;
- importjava.text.SimpleDateFormat;
- importjava.util.Date;
- importjava.util.Scanner;
- public classTest {
-
-
- publicstatic void method(){
- System.out.println("请输入年月日,格式为:yyyy-mm-dd:");
- SimpleDateFormatmyFormatter = new SimpleDateFormat("yyyy-MM-dd");
- Datedate=new Date();
- Datemydate=new Date();
- Scannerin=new Scanner(System.in);
- try{
- Strings=in.nextLine();
- date=myFormatter.parse(s);
- mydate=myFormatter.parse("1900-01-01");
- longday=(date.getTime()-mydate.getTime())/(24*60*60*1000);
- longa=day%5;
- if(a<3)
- System.out.println("三天打鱼.........");
- else
- System.out.println("两天晒网!!!!!!!!!!");
-
- }
- catch(Exception e)
- {
- System.out.println("输入错误");
- method();
-
- }
- }
- publicstatic void main(String[] args) throws ParseException {
-
- method();
- }
-
- }
复制代码
|
|