Queue
is an interface. You can't instantiate an interface directly except via an anonymous inner class. Typically this isn't what you want to do for a collection. Instead, choose an existing implementation. For example:
Queue<Integer> q = new LinkedList<Integer>();
or
Queue<Integer> q = new ArrayDeque<Integer>();
Typically you pick a collection implementation by the performance and concurrency characteristics you're interested in.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…