关于怎样控制double后小数点
程序代码:
import java.text.DecimalFormat;
public class hjj {
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));
}
}
算是找到了
public class hjj {
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));
}
}
算是找到了
----------------解决方案--------------------------------------------------------