Is it safe when compare 2 float/double directly in Java?

后端 未结 9 1023
刺人心
刺人心 2020-12-17 02:30

Is it safe if I use comparision like this (a is int, b and c is float/double):

a == b
b == c

It may hear ridiculous, but in my old programi

9条回答
  •  一向
    一向 (楼主)
    2020-12-17 02:52

    b is float and 10 is integer then if you compare both with your this critearia then it will give false because...

    b = flaot (meance ans 3.33333333333333333333333)
    10 is integer so that make sence.
    

提交回复
热议问题