package SecondJsp;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
public class LinkedListDome {
public static void main(String[] args) {
Student tom = new Student(1, "Tom", 87.0f);
Student lucy = new Student(2, "Lucy", 95.0f);
Student william = new Student(3, "William", 65.0f);
Collection c = new LinkedList();
c.add(william);
c.add(tom);
c.add(lucy);
Object[] objs = c.toArray();
for(int i = 0; i < objs.length; i++) {
System.out.println(objs[i]);
}
}
}
class Student {
private int stuld;
private String name;
private float score;
public Student() {
}
public Student(int stuld, String name, float score) {
this.stuld = stuld;
this.name = name;
this.score = score;
}
public int getStuld() {
return stuld;
}
public void setStuld(int stuld) {
this.stuld = stuld;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
public String toString() {
return "[学号:" + this.stuld + ",姓名:" + this.name + ",成绩:" + this.score + "]";
}
}