Why does java force me to add f when I use float?
<p>I'm very new to programming. I have the following code:</p>

<pre><code>float f = 18.45f;
</code></pre>

<p>this works fine. If I change that to:</p>

<pre><code>float f = 18.45;
</code></pre>

<p>java saying this as error: </p>

<pre><code>error: possible loss of precision
</code></pre>

<p>But its optional in terms of <code>double</code>. But in <code>long</code> again I'm facing the same problem.</p>

<p>Why does java forces me to do so, but not in case with <code>double</code>?</p>
