The code of method main(String[]) is exceeding the 65535 bytes limit
As your error says the main method exceeds the limit of 65535 bytes.
Reason : Why we got this error in our code?
- We know that the memory allocation for array would be done sequentially. ie; the memory would be allocated for the array if such a huge amount of space is available in RAM continuously.
- We have used String array which holds some "9000" strings - which is too large to hold in the memory
- The RAM might not have such a huge space continuously during that time so, we might have got that error.
Solution : So what can I do for this?
- For storing such huge size value we may prefer file for read/write - so we can read a part of a file when required
- We can store those strings in an ArrayList which grows its memory when element gets added to it instead of allocating memory on a whole initially.