Home Tutorial Java Scjp Part12 SCJP Module-12 Question-1

 
 

Share on Google+Share on Google+
SCJP Module-12 Question-1
Posted on: July 20, 2010 at 12:00 AM
Advertisement
The Sample program given below will test your knowledge about the NumberFormat class of Java.

Given below the sample code :

NumberFormat nform = NumberFormat.getInstance();
nform.setMaximumFractionDigits(4);
nform.setMinimumFractionDigits(2);
String i = nform.format(3.1415926);
String j = nform.format(3);

Here, the default locale is Locale.US, Which statement is true about the output of the above code ?

1. value of i = 3.141

2. value of i = 3.1415

3. value of j = 3.00

4. value of i = 3.1416

Answer

(3) & (4)

Advertisement

Related Tags for SCJP Module-12 Question-1:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 20, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com