#VSCode not outputting Arrays correctly

13 messages · Page 1 of 1 (latest)

glass egret
#

Instead of an Array a = {1, 2, 3, 4, 5, 6} i get [I@ae05b256 as an output.

agile capeBOT
#

This post has been reserved for your question.

Hey @glass egret! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

glass egret
#

is this some known issue? cuz i couldn't find anything in the google results

dark granite
#

that's correct

#

this isn't an issue, that's how they're supposed to be outputted

#

if you need to see its contents, import java.util.Arrays and use its static toString or deepToString method, passing in the array

#

arrays are objects, their default toString shows the classname@hashcode
for arrays, the classname is [ followed by something representing their contents; I means int, so [I means an int[]

glass egret
#

i'm sorry but how do i properly print it? i import the util and what do i need to write in the sysout?

dark granite
#

...println(Arrays.toString(yourArrayName));

#

also about google results; you're probably not using google correctly.

glass egret
#

shiit man sorry i googled too specificly

#

but thanks for your help man appreciated