如何修复“方法的代码..超过65535字节限制”? [英] How to fix "The code of method .. is exceeding the 65535 bytes limit"?

查看:325
本文介绍了如何修复“方法的代码..超过65535字节限制”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

  public static void main(String [] args){
try {
String [] studentnames = {
/ *这是一个9000个字符串的数组... * /
};
}
}



我尝试编译时出现以下错误:

 方法main(String [])的代码超出了65535个字节限制


解决方案


在Java中,方法不能超过65535个字节。 / p>

所以要解决这个问题,分解你的 main(String [] args)方法到多个子方法。


I have the following code:

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

I get the following error when trying to compile this:

The code of method main(String[]) is exceeding the 65535 bytes limit

解决方案

In java a methods can't have more than 65535 bytes.

So to fix this problem, break up your main(String[] args) method in to multiple sub methods.

这篇关于如何修复“方法的代码..超过65535字节限制”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆