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

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

问题描述

我有以下代码:

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

推荐答案

在 Java 中,方法不能超过 65535 个字节.

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

因此,要解决此问题,请将您的 main(String[] args) 方法分解为多个子方法.

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

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

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