Skip to content

TypeScript code snippet – How to implements an empty queue java?

import java.util.*;
 
public class Main {
   public static void main(String[] args) {
    //declare a Queue   
    Queue<String> str_queue = new LinkedList<>();
    //initialize the queue with values
    str_queue.add("one");
    str_queue.add("two");
    str_queue.add("three");
    str_queue.add("four");
    //print the Queue
    System.out.println("The Queue contents:" + str_queue);
    }
}
See also  How to let the user input desmials in Python?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.