public class T6 {
public static void main(String[] args) {
double x1=1.126;
System.out.println(String.format("%.2f",x1));
DecimalFormat df = new DecimalFormat(".00");
System.out.println(df.format(x1));
}
}
JAVA如何保留小数点后两位
猜你喜欢
转载自blog.csdn.net/qingxu1234/article/details/81141586
周排行