|
Re: Java int[] Array [I@24a1a602] [message #1126154 is a reply to message #1125692] |
Sat, 05 October 2013 07:54 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Preston,
Comments below.
On 05/10/2013 2:17 AM, Preston Deason wrote:
> Hello all, I'm having an immense amount of trouble creating integer
> arrays.
> I try to declare them like this:
>
> int[] intArray = new int
>
> And when I try to print the output to the console, I receive this:
>
> [I@24a1a602]
Yes, that's expected. The toString implementation of any array is not
all that pretty. It follows the basic default pattern of
<class-name>@<system-hash-code>. In this case, because it's an array
class, it starts with [, and because it's "int" the special short name
for that is I so you see "[I" as the class name.
>
> I'm not sure what this means, if I'm doing something wrong, or what's
> happening.
Nothing is wrong.
> I'm very sorry if this is in the wrong section, or if this has been
> answered before. I tried doing some searches but nothing seemed to
> have come up.
> Thank you in advance for any help you can provide!
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Java int[] Array [I@24a1a602] [message #1126478 is a reply to message #1126154] |
Sat, 05 October 2013 16:09 |
Eclipse User |
|
|
|
Use Arrays.toString(intArray) to get the behavior you probably want.
On 10/5/2013 3:54 AM, Ed Merks wrote:
> Preston,
>
> Comments below.
>
> On 05/10/2013 2:17 AM, Preston Deason wrote:
>> Hello all, I'm having an immense amount of trouble creating integer arrays.
>> I try to declare them like this:
>>
>> int[] intArray = new int
>>
>> And when I try to print the output to the console, I receive this:
>>
>> [I@24a1a602]
> Yes, that's expected. The toString implementation of any array is not all that pretty. It follows the basic default pattern of <class-name>@<system-hash-code>. In this case, because it's an array
> class, it starts with [, and because it's "int" the special short name for that is I so you see "[I" as the class name.
>>
>> I'm not sure what this means, if I'm doing something wrong, or what's happening.
> Nothing is wrong.
>> I'm very sorry if this is in the wrong section, or if this has been answered before. I tried doing some searches but nothing seemed to have come up.
>> Thank you in advance for any help you can provide!
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03310 seconds