1. XMLHTTPRequest to blob
2. store blob in var
3. use var as video src
这显然不起作用。我试过使用测试器。我想知道如何编写构造函数,以便它生成从0到9的随机整数?谢谢。
您可以忽略以下内容。
import java.util.Random;
public class Accidents{
static final int DAYS = 31;
static final int HOURS = 24;
private int[][] accidents = new int[DAYS][HOURS];
public Accidents(){
Random rand = new Random();
accidents[DAYS][HOURS] = rand.nextInt(10);
}
}
答案 0 :(得分:1)
您的构造函数仅设置2d数组中的最后一个值。您需要像在`totalAccidents'函数中一样遍历数组,以设置数组中的每个值。所以这样的东西应该在你的构造函数中:
for(int i=0; i<accidents.length; i++){
for(int j=0; j<accidents[0].length; j++){
accidents[i][j] = rand.nextInt(10);
}
}