Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to initialize floating-point data in java?
How to initialize floating-point data in java?
Initialization method of float type: floatscore = 78.5f.

1, java basic data type

Java defines eight simple data types: byte, short, int, long, char, float, double and boolean.

2. Default value

Except boolean default false, char->/u0000, everything else is 0.

3. Constant

Hexadecimal integer constant: when expressed in hexadecimal, it needs to start with 0X or 0x, such as 0xff and 0x9a.

Octal integer constant: Octal must start with 0, such as 0123,034.

Long integer: a long integer must end in l, such as 9L, 342L.

Floating-point constant: Because the default type of decimal constant is double, the floating-point type must be followed by f(F). Variables with decimals also default to double type.