在我的項目中,我正在使用webservices。爲了和他們一起玩,我在java中使用了Hastable。 我使用1.6.x java版本。我有一個哈希表聲明哈希表長度限制java
Hashtable<String, String> props1 = new Hashtable<String, String>();
我可以把數據在這樣
props1.put("@aze", values);
的9個第一要素:沒問題,一切運行良好。在第一次,它崩潰了......我不明白。
我該怎麼辦?
許多THX
編輯:全碼源
public static void main(String[] args) {
Hashtable<String, String> props1 = new Hashtable<String, String>();
props1.put("@matricule", values[0]);
props1.put("@nom", values[1]);
props1.put("@prenom", values[2]);
props1.put("@email", values[3]);
props1.put("@estoccasionnel", values[4]);
props1.put("@adresse", values[5]);
props1.put("@codepostal", values[6]);
props1.put("@ville", values[7]);
props1.put("@telfixe", values[8]);
props1.put("@telmobile", values[9]);
}
在 props1.put代碼中斷( 「@ telmobile」,值[9]);
與錯誤消息
java.lang.ArrayIndexOutOfBoundsException: 9
at CommandLineCreationWebservice.main(CommandLineCreationWebservice.java:99)
顯示您的代碼 – stinepike
我們需要了解您添加的方式和內容,特別是它崩潰的行和錯誤消息的內容。 – libik
+1給libik評論。沒有理由將Hashtable限制爲10條記錄,問題必須在其他地方。 –