Queue Collections Learn programming with Java exercises

Lesson:

Dynamic Memory Management


Exercise:

Queue Collections 115


Objetive:

Create a string queue using the Queue class that already exists in the DotNet platform.


Code:

import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		boolean depurando = true;

		LinkedList miCola = new LinkedList();
		miCola.offer("Hola,");
		miCola.offer("soy");
		miCola.offer("yo");

		int cantidadCola = miCola.size();

		for (byte i = 0; i < cantidadCola; i++)
		{
			System.out.println(miCola.poll());
		}

		if (depurando)
		{
			new Scanner(System.in).nextLine();
		}
	}
}