I am getteing an error as LinkedList does not take parameters
LinkedList <Integer>queue = new LinkedList<Integer>();
///////////////////////////////////////below is the code
import java.util.*;
public class ListQueueDemo {
public static void main(
String args[]) {
int numbers[]={34, 22,10,60,30};
List <Integer>list = new ArrayList<Integer>();
try{
for(int i=0; i<5; i++){
list.add(numbers[i]);
}
System.out.println("the List is: ");
System.out.println(list);
LinkedList <Integer>queue = new LinkedList<Integer>();
for(int i=0; i<5; i++){
queue.addFirst(numbers[i]);
}
System.out.println("The Oueue is: ");
System.out.println(queue);
queue.removeLast();
System.out.println("After removing last element the queue is: "+ queue);
}
catch(Exception e){}
}
}
Hope i get my answer fast
thank u