Understanding "(a == b) ? c : d" (the ternary operator) in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/463155/how-does-the-ternary-operator-work">How does the ternary operator work?</a><br>
  <a href="http://stackoverflow.com/questions/798545/what-is-the-java-operator-called-and-what-does-it-do">What is the Java ?: operator called and what does it do?</a>  </p>
</blockquote>



<p>I was browsing a code of a project done by senior developers, and I found a statement which I cannot understand. Can you explain it to me?</p>

<pre><code>public class MyClass {
    private static final int KIND_B = 1;
    private static final int KIND_C = 2;

    public Object SomeMethod(int whatKind){
        String formatType = whatKind == KIND_C ? "C obj" : "B obj"; //&lt;=== ???
    }
}
</code></pre>

<p>What does this line do, and why does it not fail to compile on account of appearing to assign an integer to a String?</p>

<p><strong>EDIT</strong></p>

<p>Guys, it's not ternary operator which confuses me. But the <strong>whole statement</strong> as it is. I need someone to interpret it to me, not to send me to definitions of a part I know. </p>
