“Possible loss of precision” in my Java program

后端 未结 5 1294
北荒
北荒 2021-01-03 03:03

I\'m new to Java. I wrote the following code:

import java.io.*;
import java.lang.*;

public class distravel
{
    public static void main(String args[])
             


        
5条回答
  •  我在风中等你
    2021-01-03 03:32

    because you declared the variable as float that mean its take up to four bytes space on random access memory,its not able to store all the data in ram , so you have to declare the variable as a double then it will work.

提交回复
热议问题