Results 1 to 3 of 3
  1. #1
    Yakg is offline Member
    Join Date
    Dec 2010
    Posts
    59
    Rep Power
    0

    Default A weird message [[I@ab54eb

    Hi, I have tried to solve this problem but I am also curious about what does this message from the compiler means? [[I@ab54eb
    and why is that happens in my case?

    I'm trying to write a toString method for a multi dimensional array as this:

    public String toString (){
    String result ="";
    for (int row=0; row<array.length; row++){
    for (int column=0; column<array[row].length; column++){
    result = array [row] [column] +"\t";
    }
    }
    result = result+"\n";
    return result;
    }

    //Thank you for helping.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Is your array variable a multi-dimensional array of Integer objects? You're getting a default toString output from an array, and it suggests possibly a 2-dimensional Integer (or int?) array. Since result is a already the the array item held in a 2-D array, I have to wonder if that array item also holds an array.

    Also, to help us help you, please read my link below on how to use code tags.

    Much luck!

    Edit, it's the toString for a 2D int array, not an Integer array. The first part of the "weird message" above, the "[[I" is the class name of the array.

    [[ -- means a 2D array, and
    I -- means of an int.

    The second part of the "weird message" -- "@ab54eb", is '@' followed by the hashCode representation of the object in hex notation. This is likely the internal address of the array object, but not necessarily.

    You can read up on all this in the API for Object: http://download.oracle.com/javase/6/...ng/Object.html
    Last edited by Fubarable; 12-11-2010 at 03:29 PM.

  3. #3
    Yakg is offline Member
    Join Date
    Dec 2010
    Posts
    59
    Rep Power
    0

    Default It works thank you!

    I guess I forgot to initialize its size...

Similar Threads

  1. Replies: 6
    Last Post: 06-04-2010, 09:43 PM
  2. Weird output
    By gandalf5166 in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 10:17 PM
  3. weird problem
    By GPB in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 01:04 PM
  4. Seriously weird output
    By gandalf5166 in forum Java Applets
    Replies: 4
    Last Post: 02-27-2010, 05:16 AM
  5. Weird Error?
    By sciguy77 in forum New To Java
    Replies: 4
    Last Post: 01-20-2009, 03:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •