发财的小手点点赞,感谢大家! 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)); } }