Question: ```
public class Venus1
{
    public static void main(String args[])
    {
        int[]x={1,2,3};
        int[]y={4,5,6};
        new Venus1().go(x);
    }
    void go(int... z)
    {
        for(int i:z)
            System.out.println(z[0]);
    }
}

```

The output is `111`

How do I change the code so it returns `123`?

Answer: 
**What You were doing wrong:**

You were trying to print the same index of the array `z`.

```
System.out.println(z[0]);

```

The above statement prints the first index value again and again.

**What You need to do:**

Since the loop runs over `i` so you need to print the `ith` index instead of the same index again and again. 

**Solution:**

Use the following code:

```
void go(int... z)
{
    for(int i = 0; i < z.length; i ++) {
        System.out.println(z[i]);
    }
}

```

Hope it's all clear now.
```
void go(int... z)
{
    for(int i = 0; i < z.length; i ++) {
        System.out.println(z[i]);
    }
}

```

Your code is almost correct, but you are fetching the first array entry all the time in your loop (z[0] will pick the first entry with index 0 of array z). To change this, loop over the number of entries existing in the array (z.length) and increase variable i each time (start with 0). Use it as your array index inside the loop to get the array entry matching your current iteration.