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

前端 未结 3 477
广开言路
广开言路 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:05

    You need to define constant variable as a float, since km is read as a float.

    final float KM_TO_ML = 0.621371F;
    m = km * KM_TO_ML;
    

提交回复
热议问题