Scanner doesn't stop to get input.

Alright, very noob question. I'm making a CLI app that lets users design surveys. First they enter the question, then the number of choices and the choices. I'm using a Scanner to get input, and for some reason it lets the user enter most things, but not the text of the question. Code snippet below. String title = ""; Question[] questions; int noOfQuestions = 0; int[] noOfChoices; Scanner entry = new Scanner(; System.out.println("Please enter the title of the survey: "); title = entry.nextLine(); System.out.println("Please enter the number of questions: "); noOfQuestions = entry.nextInt(); noOfChoices = new int[noOfQuestions]; questions = new Question[noOfQuestions]; for (int i = 0; i

以上就是Scanner doesn't stop to get input.的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准