How to fix “The code of method .. is exceeding the 65535 bytes limit”?

后端 未结 8 948
执念已碎
执念已碎 2020-12-14 15:36

I have the following code:

public static void main(String[] args) {
    try {
        String[] studentnames = {
            /* this is an array of 9000 strin         


        
8条回答
  •  北海茫月
    2020-12-14 16:10

    I would read the students names from a file however one work around which will make the class smaller as well

    String[] studentnames= "Student names is an array of :9000".split(" ");
    

    Instead of defining and using 9000 strings, this uses just one. The limit for a single String is just over 2 billion.

提交回复
热议问题