我正在嘗試使用hashmap創建一個帶有單詞列表的簡單遊戲。我想要做的是。我想用亂碼的方式向用戶顯示一個單詞。比如說你好會是「loeh」。用戶將不得不輸入他的答案,如果答案是正確的,用戶會得到一個答案。有人可以告訴如何能夠在地圖列表中加密密鑰以顯示給用戶;顯示使用hashmap的單詞和清單的列表
這是我到目前爲止的代碼;
public class Game extends Applet {
/*
* (non-Javadoc)
*
* @see java.applet.Applet#init()
*/
// create a list words with answers. probbaly a map list
Map<String, String> words = new HashMap<String, String>();
// add words and definition to the list
words.put("HI", " A form Salutation");
請刪除代碼,因爲他們混淆了讀者和作無謂的長期問題是無關你的問題的部件 – LionC 2013-05-02 13:42:04