Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 979597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:14:40+00:00 2026-05-16T04:14:40+00:00

I get this when I call toString on an object I received from a

  • 0

I get this when I call toString on an object I received from a function call. I know the type of the object is encoded in this string, but I don’t know how to read it.

What is this type of encoding called?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:14:40+00:00Added an answer on May 16, 2026 at 4:14 am

    [Ljava.lang.Object; is the name for Object[].class, the java.lang.Class representing the class of array of Object.

    The naming scheme is documented in Class.getName():

    If this class object represents a reference type that is not an array type then the binary name of the class is returned, as specified by the Java Language Specification (§13.1).

    If this class object represents a primitive type or void, then the name returned is the Java language keyword corresponding to the primitive type or void.

    If this class object represents a class of arrays, then the internal form of the name consists of the name of the element type preceded by one or more '[' characters representing the depth of the array nesting.
    The encoding of element type names is as follows:

    Element Type        Encoding
    boolean             Z
    byte                B
    char                C
    double              D
    float               F
    int                 I
    long                J
    short               S 
    class or interface  Lclassname;
    

    Yours is the last on that list. Here are some examples:

    // xxxxx varies
    System.out.println(new int[0][0][7]); // [[[I@xxxxx
    System.out.println(new String[4][2]); // [[Ljava.lang.String;@xxxxx
    System.out.println(new boolean[256]); // [Z@xxxxx
    

    The reason why the toString() method on arrays returns String in this format is because arrays do not @Override the method inherited from Object, which is specified as follows:

    The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

    getClass().getName() + '@' + Integer.toHexString(hashCode())
    

    Note: you can not rely on the toString() of any arbitrary object to follow the above specification, since they can (and usually do) @Override it to return something else. The more reliable way of inspecting the type of an arbitrary object is to invoke getClass() on it (a final method inherited from Object) and then reflecting on the returned Class object. Ideally, though, the API should’ve been designed such that reflection is not necessary (see Effective Java 2nd Edition, Item 53: Prefer interfaces to reflection).


    On a more “useful” toString for arrays

    java.util.Arrays provides toString overloads for primitive arrays and Object[]. There is also deepToString that you may want to use for nested arrays.

    Here are some examples:

    int[] nums = { 1, 2, 3 };
    
    System.out.println(nums);
    // [I@xxxxx
    
    System.out.println(Arrays.toString(nums));
    // [1, 2, 3]
    
    int[][] table = {
            { 1, },
            { 2, 3, },
            { 4, 5, 6, },
    };
    
    System.out.println(Arrays.toString(table));
    // [[I@xxxxx, [I@yyyyy, [I@zzzzz]
    
    System.out.println(Arrays.deepToString(table));
    // [[1], [2, 3], [4, 5, 6]]
    

    There are also Arrays.equals and Arrays.deepEquals that perform array equality comparison by their elements, among many other array-related utility methods.

    Related questions

    • Java Arrays.equals() returns false for two dimensional arrays. — in-depth coverage
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.