看板 java 關於我們 聯絡資訊
※ 引述《johnkuokuo@kkcity.com.tw (無言)》之銘言: : 底下我自己寫了一個小的程式(有關於hashtable的程式) : 不知道為什麼會有NoSuchElementException發生 : 有人可以解說一下嗎,,,謝謝!! : while(ek.hasMoreElements()) 只要你沒有執行 ek.nextElement() 這個判斷式就不會更新。 而且可能不能肯定ek的順序一定會跟ev的順序一樣。 如果你只是想把value列表 那你要把ek換成ev : { : System.out.println((String)ev.nextElement()); : } -- I am a person, and I am always thinking . Thinking in love , Thinking in life , Thinking in why , Thinking in worth. I can't believe any of what , I am just thinking then thinking , but worst of all , most of mine is thinking not actioning... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.134.27.68