所以我只是想打印一个随机的单词,就是这样
Dictionary secret = new Dictionary();
secret.getRandomWord();
System.out.println(secret);
^所有这些都在我的主程序中。以及我必须使用的东西
public String getRandomWord(){
Random generator = new Random();
String temp = new String();
temp += dictionary[generator.nextInt(NUMBER_OF_WORDS)];
return temp;
上面的代码是我必须使用的一个类。当我运行我的代码program3.Dictionary@a37368
时,我得到它应该是一个随机词。有任何想法吗?