home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
Stacks3.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
737b
|
28 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import com.objectspace.jgl.*;
import java.util.Enumeration;
public class Stacks3
{
public static void main( String[] args )
{
Queue queue = new Queue();
queue.push( "bat" );
queue.push( "cat" );
queue.push( "dog" );
System.out.println( "queue = " + queue );
System.out.println();
System.out.println( "Non-destructively enumerate the Queue." );
Enumeration e = queue.elements();
while ( e.hasMoreElements() )
System.out.println( e.nextElement() );
System.out.println();
System.out.println( "Pop and print each element." );
while ( !queue.isEmpty() )
System.out.println( queue.pop() );
}
}