我想创建一个类,它将通过以一个数组作为输入(其中包括)创建一个矩阵。这个数组将被分配给一个记录(Record9)。然而,我在编译时遇到这个错误。您可以在下面找到我的代码:作业:错误:无效的方法声明;返回类型要求
public class Matrix3x3flat {
private class Record9 {
public long r1c1;
public long r1c2;
public long r1c3;
public long r2c1;
public long r2c2;
public long r2c3;
public long r3c1;
public long r3c2;
public long r3c3;
}
private Record9 mat;
public Record9(long[] arr) {
Record9 this.mat = new Record9();
this.mat.r1c1 = arr[0];
this.mat.r1c2 = arr[1];
this.mat.r1c3 = arr[2];
this.mat.r2c1 = arr[3];
this.mat.r2c2 = arr[4];
this.mat.r2c3 = arr[5];
this.mat.r3c1 = arr[6];
this.mat.r3c2 = arr[7];
this.mat.r3c3 = arr[8];
return this.mat;
}
}
我不明白的问题,但我怀疑它是与我在return语句不正确引用this.mat。