Why toString() returns an hexadecimal code?

对着背影说爱祢 提交于 2019-12-11 14:12:09

问题


I have this written in my app

LastFmServer server = AndroidLastFmServerFactory.getServer();
Artist[] results;
results = server.searchForArtist("Hatebreed"); 
Log.e("", results[2].toString());

Why does this code make this appear in logcat?

fm.last.api.Artist@2bf03488

回答1:


It's because that class doesn't implement its own toString, so you end up calling the one inherited from java.lang.Object that gives you the class name and its hash.



来源:https://stackoverflow.com/questions/11924018/why-tostring-returns-an-hexadecimal-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!