如何创建一个新变量来存储在 ArrayList 中?
How to create a new variable to store in an ArrayList?
我想在 ArrayList 中存储一个值,但我该怎么做?
这是我的代码:
public class JavaTutorials{
static double cor = 3.90000231;
static double result = 0;
static ArrayList<Double> chilist = new ArrayList<>();
static ArrayList<Integer> ilist = new ArrayList<>();
public static void main(String[] args) throws InterruptedException{
int j;
for(j = 0; j <= 999999999; j++){
result = result * cor + j;
}
}
}
谢谢。
public static void main(String[] args) throws InterruptedException{
int j;
for(j = 0; j <= 999999999; j++){
result = result * cor + j;
chilist.add(result)
}
}
是这样的吗?
我想在 ArrayList 中存储一个值,但我该怎么做?
这是我的代码:
public class JavaTutorials{
static double cor = 3.90000231;
static double result = 0;
static ArrayList<Double> chilist = new ArrayList<>();
static ArrayList<Integer> ilist = new ArrayList<>();
public static void main(String[] args) throws InterruptedException{
int j;
for(j = 0; j <= 999999999; j++){
result = result * cor + j;
}
}
}
谢谢。
public static void main(String[] args) throws InterruptedException{
int j;
for(j = 0; j <= 999999999; j++){
result = result * cor + j;
chilist.add(result)
}
}
是这样的吗?