java 实例 货币格式
2017-03-26 21:58 backyyan 阅读(627) 评论(0) 编辑 收藏 举报import java.util.*; import java.text.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double payment = scanner.nextDouble(); scanner.close(); String us = NumberFormat.getCurrencyInstance(Locale.US).format(payment); String india = NumberFormat.getCurrencyInstance(new Locale("en","in")).format(payment); String china = NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment); String france = NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment); // Write your code here. System.out.println("US: " + us); System.out.println("India: " + india); System.out.println("China: " + china); System.out.println("France: " + france); } }