1:java货币格式
//本地化货币
NumberFormat formatter = NumberFormat.getCurrencyInstance();
//设置小数位数为2
formatter.setMaximumFractionDigits(2);
//格式化输出
formatter.format(book.getPrice());
//本地化货币
NumberFormat formatter = NumberFormat.getCurrencyInstance();
//设置小数位数为2
formatter.setMaximumFractionDigits(2);
//格式化输出
formatter.format(book.getPrice());