By: | 4 |
In the below code , it gives error at compile time "Possible lose of precision".Please provide me reason for this. You are watching: Possible loss of precision error in java import java.util.Scanner;class one public static void main(String args<>) Scanner sr = new Scanner(System.in); int i; long a=5; long arr<> = brand-new long; for(i=0;i arr=sr.nextInt(); for(i=0;i System.out.print(arr+" "); | 2 |
int the line:long arr<> = brand-new long; friend are specifying the dimension of array ,which should be int type,and you are passing a as long type. | 0 |
By: ![]() | |
Are girlfriend Satisfied :2Yes2No |
when float within the size parameter get rounded, the causeg a loss of precision. | 0 |
By: ![]() | |
Are you Satisfied :1Yes3No |
rishi ns am no satisfied v your answer. Because this password is operation successfully. Course aj public static void main(String args<>) lengthy arr<> = brand-new long<5>; | 0 |
By: | |
Are friend Satisfied :1Yes0No |
obviously it need to be.... See more: Which Improves Air Circulation In Forced-Air Heating, A, Radiation B, Conduction, C, Convection long arr<> = brand-new long<5>; while creating the selection of long kind the size have to be in int, in range class"s constructor the size parameter is identified as int, and whenever you room passing long a ,then int is not qualified to store the lengthy value,because it"s range exceeds the int range,that"s why lose of precision error wake up .. If you create 5 directly it is thought about as int ,so no problem.. | 1 |
By: ![]() ![]() ![]() ![]() ![]() ![]() |