Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedQueueExample1 { public static void main(String[] args) { //Create list Queue
queue = new PriorityQueue
(); queue.add("A"); queue.add("B"); queue.add("C"); queue.add("D"); //Create type safe view of the List System.out.println("Type safe view of the Queue is: "+Collections.checkedQueue(queue,String.class)); } }
Output