Multiplying float values “possible lossy conversion from double to float”

前端 未结 3 472
广开言路
广开言路 2020-12-12 05:25

I have this problem wherein I have to convert kilometers into miles. I\'m a novice programmer so bear with me.

Here\'s my code so far:

import java.ut         


        
3条回答
  •  死守一世寂寞
    2020-12-12 06:10

    You are trying to set a double to a float variable

    To fix, change this line

    m=km*0.621371;
    

    to

    m=km*0.621371f;
    

提交回复
热议问题