发财的小手点点赞,感谢大家!
import java.text.DecimalFormat; 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)); } }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/198133.html原文链接:https://javaforall.net
