小數點精度 === ```java= NumberFormat nf = NumberFormat.getInstance(); // 數字格式 nf.setMaximumFractionDigits(2); // 限制小數第二位 float result = (float)150 / (float)7; // 計算BMI System.out.println(nf.format(result)); // 顯示BMI計算結果 ``` ###### tags: `實作相關`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up