[英]Creating a Queue from LinkedList
I have a problem with creating a Queue object.I dont know what is wrong. 我在创建Queue对象时遇到问题。我不知道出了什么问题。
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;
线程“主”中的异常java.lang.Error:未解决的编译问题:LinkedList类型不是通用的; it cannot be parameterized with arguments
不能使用参数对其进行参数化
might be a name conflict ( see if you have a class named LinkedList somewhere in your default package ) 可能是名称冲突( 请查看默认包中某处是否有一个名为LinkedList的类 )
Try this - 尝试这个 -
Queue<Integer> q = new java.util.LinkedList<Integer>();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.