那个帮我看看
来源:百度知道 编辑:UC知道 时间:2024/05/22 21:14:06
/*导入LinkedList类*/
import java .util.LinkedList;
/**
* 这个程序演示LinkedList类的用法
* @version 1.0, 2008年6月19日
* @author Michael
*/
class QueueTest{
/**这是一个LinkedList对象*/
LinkedList <String> starListObj;
/**
* 构造方法,初始化 LinkedList 对象
*/
QueueTest(){
starListObj = new LinkedLis();
}
/**
* 将值添加到LinkedList 对象
* @param obj 接收参数
*/
public void enqueue(Object obj){
starListObj.addLast(obj);
}
/**
* 从LinkedList 对象删除值
* @return 返回一个对象
* @throws Exception 对象
*/
public Object dequeue() throws Exception{
return starListObj.removeFirst();
}
/**
* 调用enqueue 和 dequeue 方法
*/
void test() {
System.out.pri
import java .util.LinkedList;
/**
* 这个程序演示LinkedList类的用法
* @version 1.0, 2008年6月19日
* @author Michael
*/
class QueueTest{
/**这是一个LinkedList对象*/
LinkedList <String> starListObj;
/**
* 构造方法,初始化 LinkedList 对象
*/
QueueTest(){
starListObj = new LinkedLis();
}
/**
* 将值添加到LinkedList 对象
* @param obj 接收参数
*/
public void enqueue(Object obj){
starListObj.addLast(obj);
}
/**
* 从LinkedList 对象删除值
* @return 返回一个对象
* @throws Exception 对象
*/
public Object dequeue() throws Exception{
return starListObj.removeFirst();
}
/**
* 调用enqueue 和 dequeue 方法
*/
void test() {
System.out.pri
package dd;
import java .util.LinkedList;
/**
* 这个程序演示LinkedList类的用法
* @version 1.0, 2008年6月19日
* @author Michael
*/
class QueueTest{
/**这是一个LinkedList对象*/
LinkedList <String> starListObj;
/**
* 构造方法,初始化 LinkedList 对象
*/
QueueTest(){
starListObj = new LinkedList();
}
/**
* 将值添加到LinkedList 对象
* @param obj 接收参数
*/
public void enqueue(Object obj){
starListObj.addLast((String)obj);
}
/**
* 从LinkedList 对象删除值
* @return 返回一个对象
* @throws Exception 对象
*/
public Object dequeue() throws Exception{
return starListObj.removeFirst();
}
/**
* 调用enqueue 和 dequeue 方法
*/
void test() {
System.out.println("在队列中添加数据对象");
enqueue(new String("Martina Navratilova"));
enqueue(new Str