Question: I am now learning Varargs in java.
I wrote this method:

```
 public static void vrati(Object... arguments){
    for(Object i : arguments)

    System.out.println(i);
}

```

Then I called the method:

```
 main.vrati(8,2,"String");

```

So my question is: does varargs cast primitive types to object?
Because I have mixed in int and String in this method call and can access them like is one object.

Answer: 
Varargs are the variable number of arguments. It allows arguments from 0 to unlimited. Varargs are denoted by ... (triple dots). Varargs must be the last argument of the function. Consider the following program :

```
class Test
{
    static void display(Object ... o)
    {   
        for(Object o1 : o)
            System.out.print(o1+" ");
        System.out.println();
    }
    public static void main(String []args)
    {
        display();
        display(10,20,30,40,50);
        display(10.2f,20.3f,3.14f);
    }
}

```
"Varargs" are mainly syntactic sugar.

So 

```
Whatever...

```

turns into

```
Whatever[]

```

In other words: the method takes an **array** of the Vararg-type you are using. 

And the compiler makes sure that each and any invocation of a vararg-method receives an array (so the compiler is inserting the `new Whatever[]` more or less for you).

And please note: the fact that your example relies on **auto-boxing** has nothing to do with the fact that you are also using varargs.

If the signature of your method would have been `Object[]` instead, it works the same way (minus the little thingy that you have to pass an array now, instead of just listing your values, separated by comma).