Menu
Topics Index
...
`

Currency


If you need explanation Read this topic

If you need Answer Take test on this topic

Currency
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));
    }
}

A. $10,500.02
NT$10,500.02
€ 10.500,02
B. $10,500.02
NT$10,500.02
€ 10,500,02
C. $10,500.02
NT$10,500.02
$10,500.02
D. $10,500.02
NT10,500.02
?10,500.02
Topic: Number Format

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

A is the answer. bcz we r printing the currencies of repective countries.which can be acheived suing Numberformat object.

Posted by Shabaaz Shaikz    2014-04-17 13:10:59


there is no ans ...u have given 10.500,02 insted of 10,500.2

Posted by Ashok Reddi    2014-04-17 13:26:35


Ans is A util package consists of all sub packages system utilities currency date etc as number is 10500.0236 the is printed as respective currencies of US TAIWAN ITALY so ans is A

Posted by Naga Sinst    2014-04-18 03:55:58


Congratulations Shabaaz Shaikz. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-04-18 04:18:31


Thanq:-)

Posted by Shabaaz Shaikz    2014-04-18 05:00:25


© meritcampus 2019

All Rights Reserved.

Open In App