//包名 import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.ParseException; public class DecimalFormatTest { public static void main(String[] args) { DecimalFormat df = new DecimalFormat("###,###.##"); NumberFormat nf = NumberFormat.getInstance(); try { System.out.println(df.format((nf.parse("123123.12")))); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
时间: 2024-10-21 15:36:30