public class StaticInitBlockDemo {
static double[] arra = null;
static {
int size = 5;
array = new double[size];
for (int i = 0; i < array.length; i++) {
array[i] = Math.random();
}
}
public static void main(String[] args){
for(int i =0 ;i<array.length;i++ ){
System.out.println(array[i]);
}
}
}
Static Variable
沒有留言:
張貼留言