SCJP Module-12 Question-4

The Sample program given below will check your understanding of number formating in Java.

 
 

Share on Google+Share on Google+

SCJP Module-12 Question-4

Ads

The Sample program given below will check your understanding of number formating in Java.

Given below the sample code :

1. double in= 314159.26;
2. NumberFormat nof = NumberFormat.getInstance(Locale.ITALIAN);
3. String str;
4. //insert code here

Which code should be inserted at line 4 to set the value of b to 314.159,26?

1.str = nof.parse(in);

2.str = nof.format(in);

3.str = nof.equals(in);

4.str = nof.parseObject( in);

Answer

(2)

Advertisements

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