- import java.text.DecimalFormat;
- public class Main {
- public static void main(String[] args) {
- DecimalFormat df = new DecimalFormat( "0.0000 ");
- double d1 = 1.0;
- double d2 = 4.56789;
- System.out.println(df.format(d1));
- System.out.println(df.format(d2));
- }
- }
关于java需要控制double类型小数点后的位数,
猜你喜欢
转载自blog.csdn.net/yilongdashi/article/details/80453612
今日推荐
周排行