我一直在研究数组,当我声明一个方法时,它会给出3个错误,请帮我修复它们.
我的代码是
public class Dummy {
public static void main(String args[]) throws Exception {
Random rand=new Random();
int[] a={1,3,-3};
int[] b={2,1,-4};
public int sum() {
}
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是
Syntax error on token "int", @ expected
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete BlockStatement
Run Code Online (Sandbox Code Playgroud)
我通过查看报告的类似错误尝试了一些替代方案,但没有找到任何其他解决方案
谢谢