0

我有以下代码,我已多次修改:

public class double3 {
    public double x=0;
    public double y=0;
    public double z=0;
    public double3(double a, double b, double c){
        this.x=a;
        this.y=b;
        this.z=c;
    }
}


double3[] samples = new double3[4];//syntax error on token ";", { expected after this token
samples[0]=new double3(1,2,3);

这里发生了什么,日食想对我说什么?

4

1 回答 1

2

声明

double3[] samples = new double3[4];
samples[0] = new double3(1,2,3);

应该在代码块中,例如方法、构造函数或实例初始化程序

于 2013-11-07T00:57:47.430 回答