Why?
public String selectReconstruction(String[] roads){
String result= " ";
for (int i = 0; i < roads.length; i++) {
StringTokenizer st = new StringTokenizer(roads[i], " ");
String id = st.nextToken();
String s = st.nextToken();
String f = st.nextToken();
int cost=st.hasMoreElements()?Integer.parseInt(st.nextToken()):0;
vertics.add(s);
vertics.add(f);
ids.put(s, s);
ids.put(f, f);
Edge e1 = new Edge(id,s,f,cost);
edges.add(e1);
}
循环第一次正常,第二次就发生
ClassCastException,why?
------解决方案--------------------装箱时出错?
帮顶。。。
------解决方案--------------------哪一个语句抛出的异常?!