关于java中的int[]数组和令牌错误
我试图从另一个文件调用一个函数,我的代码中有这个,当我试图编译它时,它说有一个令牌错误。更改关于java中的int[]数组和令牌错误,java,arrays,Java,Arrays,我试图从另一个文件调用一个函数,我的代码中有这个,当我试图编译它时,它说有一个令牌错误。更改 public class ScoreIt2 { public static void main(String [] args) { ScoreIt h= new ScoreIt(); System.out.println(h.maxPoints([2, 2, 3, 5, 4 ])); } } public class ScoreIt {
public class ScoreIt2
{
public static void main(String [] args)
{
ScoreIt h= new ScoreIt();
System.out.println(h.maxPoints([2, 2, 3, 5, 4 ]));
}
}
public class ScoreIt
{
public int maxPoints(int[] toss)
{
}
}
到
这是有效的语法当询问问题时,最好包含编译器给出的确切错误消息,并对它们引用的任何行号进行注释。天哪,这很有效!非常感谢@JigarJoshi让派对开始了。
System.out.println(h.maxPoints([2, 2, 3, 5, 4 ]));
System.out.println(h.maxPoints(new int[] {2, 2, 3, 5, 4 }));