java中的货币支持

//获取金融货币格式
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.CHINA);

//带货币符号的输出
       
        System.out.println(account_type + ":" + "current balance is" +  nf.format(account.getBalance()));

需要引用
import java.text.NumberFormat

Leave a Reply

Your email address will not be published. Required fields are marked *