在netbeans中运行java代码时出错

时间:2015-04-05 22:07:43

标签: java

我正在编写一个名为events的类,并在这个类中实现一些方法。出于某种原因,在从主程序运行程序时,程序在用户输入开始日期后停止,并显示消息构建成功。所以它会跳过下面的其他代码。

以下是代码:

    public void CreateEvent(){

    try{

        BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
        event MyNewEvent = new event();
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        Date date = new Date();   
        JDBC MyJDBC = new JDBC();
        Connection conn = null;
        Statement stmt = null;


        //getting inputfrom the user
        System.out.print("Event Name \n");
        MyNewEvent.EventName = inFromUser.readLine();

        System.out.println("Kindly Provide the start date(Format dd MM yyyy HH:mm)");
        //parsing date from user using SimpleDateFormat
        date = sdf.parse(inFromUser.readLine());
        System.out.println("Kindly Provide the end date(Format dd MM yyyy HH:mm)");
        MyNewEvent.startDate = date.toString();

        System.out.println("Kindly Provide the end date(Format dd MM yyyy HH:mm)");
        date = sdf.parse(inFromUser.readLine());
        MyNewEvent.endDate = date.toString();

        MyNewEvent.CheckDate(MyNewEvent, sdf, inFromUser);

        System.out.println("Where is the event:");
        MyNewEvent.Location=inFromUser.readLine();

        System.out.println("Description");
        MyNewEvent.Description= inFromUser.readLine();


    }
    catch (IOException ex) {//catch the exception

        ex.printStackTrace();
    }
    catch (ParseException e) {

        ;
    }

}

0 个答案:

没有答案