Question: why, 

```
System.out.println(Integer.parseInt("17", 8));

```

print out: **15**

and, 

```
System.out.printf("%o", 17);

```

print out: **21**

Aren't they supposed to return octal value of 17?

Answer: 
Your first example converts the octal value 17 to decimal, which is 15.

Your second example converts the decimal value 17 to octal, which is 21.

If you modify your second example to use `017` (octal 17), you'll get the same result.
According to the Java API

```
 parseInt(String s, int radix)

```

* s - This is a string representation of decimal.
* radix - This would be used to convert String s into integer.

So your `Integer.parseInt("17", 8)` will convert "17" to decimal using base value of 8 which is resulted 15

`"%o"` is use to format as Octal value so 17 will be represented as a Octal value. And result will be 21

So all the outputs that you get is correct.