How to return a vector from a class into another class : <p>I'm trying to use arrays with java and when i return the array froma  class it prints [I@7d4991ad (that should be the address), but how to return all the elements?</p>

<p>(by the way, I always mess with JavaScript and Java and I don't know which one eclipse is, I apologize)</p>

<p>Basically I did a return of the name of the vector with the metod int[]</p>

<pre><code>public class TestVettori {

    private int vector[];
    private int length;

    //function input lengt
    public void setLength(int newLung) {
        if(newLung&gt;=1) 
           length=newLung;      
    }

    //function input
    public void inputValue(int[] vett) {

        vector = new int [length];

        for(int i=0;i&lt;length;i++) 
            vector[i]=vett[i];      
    }

    //function print array
    **public int[] getVector() {
        return vector;
    }** 
}
</code></pre>

<pre><code>import java.util.Scanner;

public class ProgTestVettori {

    public static void main(String[] args) {
        Scanner in= new Scanner (System.in);

        int lung ;
        int vett[];

        TestVettori vector;

        System.out.println("Put the length of the array");
        lung = in.nextInt();

        vett = new int [lung];

        vector = new TestVettori();

        vector.setLength(lung);

        for(int i=0;i&lt;lung;i++) {
            System.out.println("Input the"+(i+1)+" number");
            vett[i]=in.nextInt();
        }

        vector.inputValue(vett);


        **for(int i=0;i&lt;lung;i++) {
            System.out.println("the "+(i+1)+"° number is"+vector.getVector());
        }**




        in.close();
    }
}

</code></pre>

<p>I pasted all the code so you can see all of it:
I put the length, let's suppose 3
i put numbers and i should expect numbers from the console, but i get 3 times
[I@7d4991ad the address...</p>
