0

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
BamsBamx
  • 4,139
  • 4
  • 38
  • 63

1 Answers1

3

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.

Lord Spectre
  • 761
  • 1
  • 6
  • 21
  • so what have i to do to appear the string? – BamsBamx Aug 12 '12 at 17:02
  • You should find that class' documentation, but probably it's something like `results[2].name` or `results[2].getName()`; most probably the second. – Lord Spectre Aug 12 '12 at 17:10
  • It's doesn't **override** `toString`. It's already implemented by `Object` – Dmitry Zaytsev Aug 12 '12 at 17:28
  • a tip for future, In your IDE(Eclipse..) when you make a Object of a custom class then you can always put a `. dot` after that Object like in your case `results[0].` and then press `Ctrl + space` for `intellisense` :) – Mohsin Naeem Aug 12 '12 at 17:29