cannot instantiate the type
instantiate ---instant--instance實例---instant立刻的迫切的-----instantiate實例化
無法實例化這個類
我的error:cannot instantiate the type Queue
Queue<Integer>[] queues=new Queue[radix]; for(int i=0;i<radix;i++) queues[i]=new Queue<Integer>();
通過stackflow:java.util.Queue是個接口,當然不能實例化了****因為之前常用stack,所以以為queue也是類,沒想到就栽了
【P.S.想起來之前二叉樹廣度優先遍歷了,也是用的queue,查看了一下,果然是Queue<BinTreeNode> queue=
new
LinkedList<BinTreeNode>();
】
|
這樣才對嘛
Queue<Integer>[] queues=new LinkedList[10]; for(int i=0;i<10;i++) queues[i]=new LinkedList<>();