當我嘗試運行此代碼:「無法實例的類型......」
import java.io.*;
import java.util.*;
public class TwoColor
{
public static void main(String[] args)
{
Queue<Edge> theQueue = new Queue<Edge>();
}
public class Edge
{
//u and v are the vertices that make up this edge.
private int u;
private int v;
//Constructor method
public Edge(int newu, int newv)
{
u = newu;
v = newv;
}
}
}
我得到這個錯誤:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Cannot instantiate the type Queue at TwoColor.main(TwoColor.java:8)
我不明白爲什麼我不能實例班...看起來對我來說......
可能重複的[無法實例化類型列表](http://stackoverflow.com/questions/7960149/cannot-instantiate-the-type-listproduct) –
Raedwald
2014-07-17 12:12:06