Menu
Question Index
...

What is the output of the following program?

import java.text.*;
import java.util.*;

public class Local {
    public static void main(String[] args) {
        printCurrency(Locale.US);
        printCurrency(Locale.TAIWAN);
        printCurrency(Locale.ITALY);
    }
    public static void printCurrency(Locale locale) {
        double number = 10500.0236;
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        System.out.println(format.format(number));
    }
}


$10,500.02
NT$10,500.02
€ 10.500,02
$10,500.02
NT$10,500.02
€ 10,500,02
$10,500.02
NT$10,500.02
$10,500.02
$10,500.02
NT10,500.02
?10,500.02

Doubts

Problems

Topic: Number Format

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App