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

后端 未结 7 655
耶瑟儿~
耶瑟儿~ 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:49

    Also, use type.equals("C") instead of if (type == "C"), the later one is comparing the reference of the value.

提交回复
热议问题