0

So I have created an array of objects but I would like to display each object as a certain character. At the moment when I run my program, my array just looks something like this:

ObjectName@5ef3637 ObjectName@78863t6

ObjectName@764rb23 ObjectName@8b2d356

This includes a few different ojects. How can I make it so each object displays as a specific character?

  • 4
    Override `toString` method in each class of your object to return the `String` which you want to display. – user3161880 Oct 08 '16 at 13:08
  • 1
    What are these objects? How do you want to translate them to characters? Can you share some code? – Mureinik Oct 08 '16 at 13:08
  • If it comes to 2d arrays you can use static method from Arrays class: Arrays.deepToString(Object[] arr). It will print your array by invoking toString() method at every object placed in your 2D array. – Michał Szewczyk Oct 08 '16 at 13:16
  • Please see [this link](http://stackoverflow.com/questions/29140402/how-do-i-print-my-java-object-without-getting-sometype2f92e0f4) which was used to close your question as a duplicate. – Hovercraft Full Of Eels Oct 08 '16 at 13:26

0 Answers0