📜  java 循环对象 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:23.264000             🧑  作者: Mango

代码示例3
// Using the range of int i we assign new objects to the List using i as the index
List objects = new ArrayList<>();
 
for (int i = 0; i < 10; i++)
{
    // Generate or get variables
    objects.add(i, new Object(variable, variable1));
}