Why don't I see the values of the integers in a returned array in Java? -


here main method:

public static void main(string[] args) {      int[] myarray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};      (int = 0; < myarray.length; i++) {         system.out.println(myarray[i]);     }      int[] sortedarray = insertionsort.sorter(myarray);      (int = 0; < sortedarray.length; i++) {         system.out.println(sortedarray);     } } 

and here insertionsort.sorter looks like:

public static int[] sorter(int[] a) {      return a;  } 

and output:

1 2 3 4 5 6 7 8 9 10 [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b [i@7000a32b 

so missing?

for (int = 0; < sortedarray.length; i++) {     system.out.println(sortedarray); } 

what missing array index:

for (int = 0; < sortedarray.length; i++) {     system.out.println(sortedarray[i]);  // note [i] } 

or (using for-each loop):

for (int i: sortedarray){      system.out.println(i); } 

what doing print whole array (which not pretty in java).


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -