how to take large size array in java

后端 未结 6 1315
醉话见心
醉话见心 2021-01-26 07:05

i am new to java and i want to take large input size array in java. but in gives me some Runtime Error - NZEC, I don\'t know about it and i also did some research on this error

6条回答
  •  感动是毒
    2021-01-26 07:44

    Array sizes are limited to int size in java. so you need to create your array with int sizes always. you have to take n as int. and replace the long n=sc.nextLong();// n can be upto 10^9; by int n=sc.nextInt();// n can be upto 10^9;

    It will work perfectly.

提交回复
热议问题