0

Error

Why its is an error? int n = 1000; int[] a = new int[n*n*n*n]; System.out.println(a.length);

21st Sep 2020, 9:01 AM
jason Carzano
jason Carzano - avatar
2 Antworten
+ 6
Your n=1000 If you multiply 4 times Then 1000*1000*1000*1000 which will be =1000000000000 and this number is not in range of int size so enter small number which is under range of int
21st Sep 2020, 9:21 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
By the way, instead of n*n*n*n better to use n**4
21st Sep 2020, 9:36 AM
The future is now thanks to science
The future is now thanks to science - avatar