Why does an inline conditional in Java auto-cast numbers?
<p>In the following inline conditionals, one might expect an integer and a double to be printed, respectively:</p>

<pre><code>System.out.println(true ? 0 : 0.0);
System.out.println(false ? 0 : 0.0);
System.out.println(true ? new Integer(0) : new Double(0.0));
System.out.println(true ? 0 : "");
</code></pre>

<p>Instead they are both printed as doubles when occurring together:</p>

<pre><code> 0.0
 0.0
 0.0
 0
</code></pre>

<p>Why are numbers auto-cast when occurring with other numbers in inline conditionals?</p>

<p><strong>Edit</strong>: If this is occurring because <code>System.out.println</code> is overloaded what is the case for:</p>

<pre><code>list.add(true ? 0 : 0.0);
list.add(false ? 0 : 0.0);
list.add(true ? new Integer(0) : new Double(0.0));
list.add(true ? 0 : "");
System.out.println(list);
</code></pre>

<p>outputs:</p>

<pre><code>[0.0, 0.0, 0.0, 0]
</code></pre>
