Question: First of all, apologies for the following question, i am new to java, i have taken the example from a book but it fails to completely explain itself.

I have been reading about the ? operator and how it functions and using the below as an example to learn from:

```
class Ternary {
    public static void main(String args[]) {
        int i, k;
        i = 10;
        k = i < 0 ? -i : i; // get absolute value of i
        System.out.print("Absolute value of ");
        System.out.println(i + " is " + k);

        i = -10
        k = i < 0 ? -i : i; //get absolute value of i
        System.out.print("Absolute value of ");
        System.out.println(i + " is " + k);
    }
}

```

I understand how the first part gives the result of 10.
But i cannot follow how the second part gives the result of 10?

Apologies if this is plainly obvious.

Answer: 
Since the ternary operator evaluates `i < 0` in your following line of code: 

```
k = i < 0 ? -i : i; //get absolute value of i

```

If true `k = -i`

else false `k = i`

And as the others mentionned, `-(-10) == 10`
And I believe this is the output you want since you are trying to get the absolute value of a number, so if it is negative, print out it's positive value.
```
i = -10
k = i < 0 ? -i : i; 

```

is the same as

```
k = i < 0 ? -(-10) : i;

```

gives you +10