//导DecimalFormat包
import java.text.DecimalFormat;
public class Demo1 {
public static void main(String[] args) throws Exception{
DecimalFormat df = new DecimalFormat("0.00");
double d1 = 3.23456 ;
double d2 = 0.0;
double d3 = 2.0;
//返回的是个String的类型
System.out.println(df.format(d1));
System.out.println(df.format(d2));
System.out.println(df.format(d3));
}
}