0

我在收到错误代码时遇到问题:

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

在编写java时。

我对Java真的很陌生,我现在真的不知道该怎么办。


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

4

1 回答 1

0

如果您的代码如下所示:

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
    }
}
于 2015-10-17T23:25:44.867 回答