Is there any maximum size for code in Java? I wrote a function with more than 10,000 lines. Actually, each line assigns a value to an array variable.
arts_bag[10792]="newyorkartworld";
arts_bag[10793]="leningradschool";
arts_bag[10794]="mailart";
arts_bag[10795]="artspan";
arts_bag[10796]="watercolor";
arts_bag[10797]="sculptures";
arts_bag[10798]="stonesculpture";
And while compiling, I get this error: code too large
How do I overcome this?
This seems a bit like madness. Can you not initialize the array by reading the values from a text file, or some other data source?
Try to refactor your code. There is limit on the size of method in Java.
This error sometimes occur due to too large code in a single function... To solve that error, split that function in multiple functions, like