简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM