-3

Whenever I try to print the elements I copied from array stonefist to array vaporeon I get

This new array: [I@175705e

Is this a problem on my end or is this a problem with my version of java?

public class ArrayTest
{
    public static void main(String[] args)
    {
        int[] stonefist = new int[6];
        int[] vaporeon = new int[stonefist.length];
        stonefist[0] = 34;
        stonefist[1] = 2;
        stonefist[2] = 14;
        stonefist[3] = 34;
        stonefist[4] = 58;
        stonefist[5] = 4;
        int jolteon = 0;
        int flareon = 0;
        int dragonite = Integer.MIN_VALUE;
        for(int i = 0; i < stonefist.length; i++)
            {
                System.out.println(stonefist[i]);
                if(stonefist[i] > dragonite)
                {
                   dragonite = stonefist[i];                
                }                  
                 jolteon = jolteon + stonefist[i];
                 flareon = jolteon/stonefist.length;
                 System.arraycopy(stonefist,1,vaporeon,0,3);
            }
        System.out.println("The largest number is: " + dragonite);   
        System.out.println("The average is: " + flareon);
        System.out.print("This new array: " + vaporeon);
    }   
}

2 Answers2

0

This is just the default result of the Object.toString()-method and is not a problem with your version of Java.

What you need is a method that walks through the array and prints each element, for example Arrays.toString(...)

You can then use it:

System.out.print("This new array: " + Arrays.toString(vaporeon));
Ethan Leroy
  • 15,804
  • 9
  • 41
  • 63
0

It is actually printing out the memory address for the Array. You need to create a loop, or a method that contains a loop that that will step through the array, and print all the values one by one.