Why output is 0.0 when we assign double or float with some value (< 1) without suffix 'd' or 'f'? : <p>When I assign some value (&lt; 1) to float or double without any suffix 'f' or 'd' respectively, then why the output shows 0.0? My program is</p>

<pre>
  public class Example {

    double a = 1/2d;
    float b = 1/2f;
    double c = 1/2;
    float d = 1/2;

    public static void main(String[] args) {
        Example e = new Example();
        System.out.println("a: "+e.a);
        System.out.println("b: "+e.b);
        System.out.println("c: "+e.c);
        System.out.println("d: "+e.d);
    }
}
</pre>

<p>The output is </p>

<pre>
  a: 0.5
  b: 0.5
  c: 0.0
  d: 0.0

</pre>
