SCJP Module-12 Question-4


 

SCJP Module-12 Question-4

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

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)

Ads