user2110286
user2110286

Reputation:

Creating a Queue from LinkedList

I have a problem with creating a Queue object.I dont know what is wrong.

My code:

import java.util.*;
public class Demo {
    public static void main(String[] args) {

        Queue<Integer> q = new LinkedList<Integer>();


    }
}

Compiler error:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: The type LinkedList is not generic; it cannot be parameterized with arguments

Upvotes: 0

Views: 269

Answers (1)

Adil Shaikh
Adil Shaikh

Reputation: 44740

might be a name conflict (see if you have a class named LinkedList somewhere in your default package)

Try this -

 Queue<Integer> q = new java.util.LinkedList<Integer>();

Upvotes: 1

Related Questions