0

This is a part of my code. It appears that "String answer65 = in.nextLine();" does not let me to give any input and skips it . Can anyone help?

if(!orders.isEmptyList()){
                    orders.listOrders();
                    System.out.println("E");
                    int answer64 = in.nextInt();
                    Order order1 = orders.lookUp(answer64);
                    System.out.println(order1);
                    order1.getOrderStatus();
                    System.out.println("D");
                    String answer65 = in.nextLine();                        
                    if(answer65.equals("1")){
                        order1.setOrderStatus(true);
                        Sale s1 = new Sale(main.randomCode());
                        sales.addSale(s1);
                    }
                }else{
                System.out.println("There are no orders");
                }
michle dc
  • 1
  • 1
  • You probably want to wrap all these into a try..catch block, thus the program wouldn't terminate, also you can print out what kind of exception it is complaining about, then fix it from there. – Anton Apr 21 '16 at 17:24
  • I don't know how to use the try method. I didn't explained my problem right. Do you have any idea how to solve it? – michle dc Apr 21 '16 at 17:33
  • Take a look at this: http://tutorials.jenkov.com/java-exception-handling/basic-try-catch-finally.html you will know what I am talking about – Anton Apr 21 '16 at 18:05

0 Answers0