如何使构造函数设置全局数组的长度?
我已经尝试了几种方法,没有成功.
例:
public Class{
public Class(int length){
double[] array = new double[length]; <- this is not global
L = length;
}
int L;
double[] array = new double[L]; <- this does not work
}
Run Code Online (Sandbox Code Playgroud)
我需要一个长度由Constructor确定的数组.