import java.util.*; class FIFOTest {public static void main(String [] args){Fifo f=new Fifo();for(int i=0;i<5;i++){f.addque("Test First In First Out ----:" + i);}System.out.println("Loading!");while(!f.isEmpty()){System.out.println("Now is input Test First Out :"+f.removeque());}}}class Fifo extends LinkedList{void addque(Object obj){System.out.println("Now is input Test First In :"+obj); addLast(obj);}Object removeque(){return removeFirst();}public boolean isEmpty(){return super.isEmpty();}}
import java.util.*; class FIFOTest {public static void main(String [] args){int it[]={7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1};Fifo f=new Fifo();Fifo f1=new Fifo(); String start="Begin";if(start.equals("Begin")){for(int i=0;i<20;i++){if(i<3){f.addque("" + it[i]);}if(i>2){if(it[i]!=0){f.addque("" + it[i]);}}start="Test";} }}}class Fifo extends LinkedList{void addque(Object obj){System.out.println("现在正在输入的数据 :"+obj); addLast(obj); while(size()>3){Viewer(); }}Object removeque(){return removeFirst();}Object removeque1(){return removeLast();}public boolean isEmpty(){return super.isEmpty();}public void Viewer(){System.out.println("现在输出的数据: :"+removeque()); }}