【发布时间】:2011-03-17 09:19:06
【问题描述】:
我无法从自定义方法返回数组。它编译得很好,但我回来了:
[Ljava.lang.String;@20cf2c80
Press any key to continue . . .
我使用:
System.out.println(getItem(1));
代码:
public static String[] getItem(int e) {
String[] stats = new String[7];
String name = "Null";
String desc = "None";
String typeOf = "0";
String attackAdd = "0";
String defenseAdd = "0";
String canSell = "true";
String canEat = "false";
String earnedCoins = "0";
if (e == 1) {
name = "Pickaxe";
desc = "Can be used to mine with.";
typeOf = "2";
}
return new String[] { name, desc, typeOf};
}
帮助? :\
【问题讨论】:
标签: java arrays return tostring