title: float variables initialization java
body: <p>The following code snippet gave me compiler error at Line 1.</p>
  
  <pre><code>public abstract class xyz
  {
  
      float Gamma = 20.0; //Line 1
      public class Alpha
      {
          void Beta()
          {
              System.out.println("this is atest");
          }
      }
  }
  
  
  
  abc0.java:5: error: possible loss of precision
          float density = 20.0;
                          ^
    required: float
    found:    double
  2 errors
  </code></pre>
  
  <p>As per my understanding, float is used for decimal variables.</p>
  
  <p>Am I missing something obvious or should I have to always use casting for decimal variables initialization ?</p>
  
  <p>EDIT : I know 'f' can be used at the end for float variables but is it MANDATORY ?.</p>