菜鸟请教老鸟 我是一个新手 在此先谢谢各位了啊
import java.text.DecimalFormat;//引入类
public class TextP {
public static void main(String[] args) {
  double a=3.1245;
  double b=3.12453;
  double e=3.12451;
  DecimalFormat f = new DecimalFormat(); //声明对象
  String c= f.format(a); //调用对象方法
  String d= f.format(b); //调用对象的方法
  String g= f.format(e); //调用对象的方法
  System.out.println(a+"="+c);
  System.out.println(b+"="+d);
  System.out.println(e+"="+g);
  }
} 输出结果:
  3.1245=3.124
3.12453=3.125
3.12451=3.125 
  1.为什么调用这个方法后都是保留三位小数呢!
  2.能不能解释一下输出的结果5后面有没有书输出的为啥不一样啊