关于java中的int []数组和令牌错误

Yiq*_*hen -1 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 int maxPoints(int[] toss) 
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

我试图从另一个文件调用一个函数,我有我的代码,当我尝试编译它时,它说有一个令牌错误.

Jig*_*shi 5

更改

System.out.println(h.maxPoints([2, 2, 3, 5, 4 ]));
Run Code Online (Sandbox Code Playgroud)

System.out.println(h.maxPoints(new int[] {2, 2, 3, 5, 4 }));
Run Code Online (Sandbox Code Playgroud)

这是有效的语法