为什么 f 放在浮点值之后? [英] why f is placed after float values?

查看:21
本文介绍了为什么 f 放在浮点值之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么在Java或其他语言中f或F放在浮点值之后?例如,

I don't know why f or F is placed after float values in Java or other languages? for instance,

float fVariable = 12.3f;

除了表明这是一个浮点值之外的任何特征?

any features other than indicating that this is a float value?

推荐答案

默认情况下 12.3double 字面量,所以告诉编译器把它当作 float 显式 -> 它使用 fF

by default 12.3 is double literal, So to tell compiler to treat it as float explicitly -> it uses f or F

这篇关于为什么 f 放在浮点值之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆