【问题标题】:Error: Main Method exceeding bytes limit错误:主方法超出字节限制
【发布时间】:2015-10-17 22:14:54
【问题描述】:

我遇到了错误代码:

Error: The code of method main(java.lang.String[]) is exceeding the 65535 bytes limit

在编写java时。

我对 java 真的很陌生,我现在真的不知道该做什么。


我查看了其他可能的解决方案,但我不太明白他们想说什么。我不使用数组,我的代码完全由 do while 和 if 语句组成。我对这一切都很陌生。

【问题讨论】:

标签: java main-method


【解决方案1】:

如果您的代码如下所示:

public class MyClass {
    public static void main(String[] args) {
        // Do way too much stuff . . .
    }
}

让它更像这样

public class MyClass {
    public static void main(String[] args) {
        doSomeStuff();
        doMoreStuff();
    }

    public static void doSomeStuff() {
        // Do some stuff but not too much
    }

    public static void doMoreStuff() {
        // Do some more stuff but not too much
    }
}

【讨论】:

    猜你喜欢
    • 2021-12-23
    • 1970-01-01
    • 1970-01-01
    • 2020-02-15
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 2018-06-10
    相关资源
    最近更新 更多