1、Queue
import java.util.LinkedList;
public class Queue {
LinkedList queue;
public Queue() {
queue = new LinkedList();
}
void add(Object o) {
queue.addLast(o);
}
Object get() {
Object o = null;
if (!queue.isEmpty()) {
o = queue.getFirst();
queue.removeFirst();
}
return o;
}
public static void main(String[] args){
Queue q=new Queue();
System.out.println(q.get());
q.add("1");
System.out.println(q.get());
q.add("2");
q.add("3");
System.out.println(q.get());
q.add("4");
q.add("5");
System.out.println(q.get());
System.out.println(q.get());
System.out.println(q.get());
System.out.println(q.get());
}
}
2、
<%@page pageEncoding="gb2312"%>