Share on Google+Share on Google+

SCJP Module-12 Question-1

The Sample program given below will test your knowledge about the NumberFormat class of Java.

Given below the sample code :

NumberFormat nform = NumberFormat.getInstance();
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


(3) & (4)


Posted on: July 20, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null