执行@number时的Java链接列表错误消息
每当我运行该方法时,我都会收到一个错误,该错误以数字形式出现,
以下是我的代码。
public String getAccount()
{
String s = "Listing the accounts";
for(List l:lists)
s+=" "+list.toString;
Return s;
}
当我运行此方法时,我得到以下信息:
列出@一些号码
对于 List 类,我只有一个构造函数,它将解析的变量指定为局部变量。
有人知道这是什么意思吗?
Whenever i run the method, i get an error which comes with as numbers
The following is what i have as my code.
public String getAccount()
{
String s = "Listing the accounts";
for(List l:lists)
s+=" "+list.toString;
Return s;
}
I get the following when i run this method:
List@some numbers
For the List class, i just have a constructor which appoints parsed variables into local variables.
DOes someone know what this means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这意味着您尚未重写(显然)自定义
List
类中的toString
方法。默认实现 (Object.toString
) 显示如上所示的输出:您应该在自定义类中重写
toString
,以便提供所需的输出。This means that you haven't overridden the
toString
method in your (apparently) customList
class. The default implementation (Object.toString
) displays output like you show above:You should override
toString
in your custom classes, in order to provide the desired output.