Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于java中的int[]数组和令牌错误_Java_Arrays - Fatal编程技术网

关于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 }));