User Input not working with keyboard.nextLine() and String (Java)

后端 未结 7 640
耶瑟儿~
耶瑟儿~ 2020-12-22 03:06

I recently started learning java during my spare time. So to practice, I\'m making a program that takes a temperature (Celsius or Fahrenheit) and converts it to the opposite

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 03:48

    .nextInt() does not read the end of line character "\n".

    You need to put a keyboard.nextLine() after the .nextInt() and then it will work.

提交回复
热议问题