Why is the letter f used at the end of a float no.?

后端 未结 9 2262
难免孤独
难免孤独 2020-12-09 18:52

I just wanted some information about this.

float n = 2.99944323200023f

What does the f at the end of the literal do? What is i

9条回答
  •  失恋的感觉
    2020-12-09 19:07

    From the Oracle Java Tutorial, section Primitive Data Types under Floating-Point Literals

    A floating-point literal is of type float if it ends with the letter F or f; otherwise its type is double and it can optionally end with the letter D or d.

提交回复
热议问题