本文共 1387 字,大约阅读时间需要 4 分钟。
float Java Keyword with Examples
The float keyword is used to declare float primitive variable. A float variable may store a single−precision floating point value. The type float specifies a single-precision value that uses 32 bits of storage. Single precision is faster on some processors and takes half as much space as double precision, but will become imprecise when the values are either very large or very small.
The Float wrapper class is used to represent float primitive variable as an object in Java.
float Java Keyword Examples Syntaxfloat= ;
Example:
float price = 19.95;
The float keyword can be used to the declared return type of a method as well.
public float getBalance() { return balanceAmount;}
The Java wrapper class associated with the float data type is called Float that is defined in java.lang package i.e. java.lang.Float.
float f = 65.55; Float fRef = f; Remarks转载地址:http://sbgrn.baihongyu.com/