这是格式化十进制值的简单示例
import java.text.*;public class DecimalPlaces { public static void main(String[] args) { double d = 1.234567; DecimalFormat df = new DecimalFormat("#.##"); System.out.print(df.format(d)); }}
这是格式化十进制值的简单示例
import java.text.*;public class DecimalPlaces { public static void main(String[] args) { double d = 1.234567; DecimalFormat df = new DecimalFormat("#.##"); System.out.print(df.format(d)); }}