写个循环就行了,姓名和年龄是固定的值,你只把sql中,学号的值用变量,也就是循环的值就行。....id = '" + i + "'.....
能否给段程序?还要生成excel文件,并写入文件呢 不会
public class Student { String name; int id; int age; public Student(int id,String name,int age) { this.id = id; this.name =name; this.age = age; }
// TODO: add your getter and setter for all properties }public class Test { public static void main(String[] args) { List list = new ArrayList(); for(int i=1;i<=1000;i++) { list.add(new Student(i,"aa",22)); } }
{
String name;
int id;
int age;
public Student(int id,String name,int age)
{
this.id = id;
this.name =name;
this.age = age;
}
// TODO: add your getter and setter for all properties
}public class Test
{
public static void main(String[] args)
{
List list = new ArrayList();
for(int i=1;i<=1000;i++)
{
list.add(new Student(i,"aa",22));
} }
}
晕,用开源代码吧。我不写了。生成数据简单,上面随手写的。