float type literal

Floating-point literals in Java default to double precision. To specify a float literal, you must append an F or f to the constant.


public class Main {
  public static void main(String[] argv) {
    float f = 1.1f;

    System.out.println("f is " + f);

  }
}

The output generated by this program is shown here:


f is 1.1
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.