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.
Use 

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

```

instead of:

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

```

You should iterate the whole array, not the first index only so you need to print using `i` instead of `0`