大家帮帮我做这几道JAVA编程题~~谢谢

2024-12-29 13:32:31
推荐回答(1个)
回答1:

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"%>














身份证号:









3、counter.jsp

<%! public static int count=0;%>
<% count++;%>
<%=count%>