Question: I want to format an output string with a series of variables. When I use an array of strings, this works as expected:

```
String[] myArray = new String[3];
// fill array with strings
System.out.printf("1: %s \n2: %s \n3: %s\n", myArray);

```

I want to use this to print the results of simulated dice-throws, so I use an array of ints. However, this doesn’t work:

```
int[] myArray = new int[3];
// fill array with numbers
System.out.printf("1: %d \n2: %d \n3: %d\n", myArray);
Exception in thread "main" java.util.IllegalFormatConversionException: d != [I

```

Of course, I could use `myArray[0]` etc. for every element, but this doesn’t seem very elegant.

Why is this so and how can I achieve the desired result?

Answer: 
I'm not sure but String is an object whereas int is not.  

`printf` takes an Object array for the parameters.  

Try `Integer[] myArray` instead.
printf uses variable arguments so that we can pass 0 t0 n arguments to it:

`public PrintString printf(String format, Object... args);`

```
out.printf("%s:%s", a, b);

```

That is the equivalent of:

```
out.printf("%s:%s", new Object[] { a, b });

```

So, getting back to your question, for an array, you can just write:

```
out.printf("%s:%s", things);

```