Fahrenheit to Celsius conversion yields only 0.0 and -0.0

后端 未结 5 1945
不思量自难忘°
不思量自难忘° 2020-12-02 01:06

I\'m on the 8th chapter (Methods, Constructors, and Fields) of my Java methods book and I\'m having a problem with one of my exercises.

The provided code is Tempera

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 01:34

    change (5 / 9) to (5.0 / 9.0) to let java know, that you want real numbers division.

提交回复
热议问题