Queue Collections Learn programming Java

Lesson:

Dynamic Memory Management


Exercise:

Queue Collections


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();
		}
	}
}

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.