Given:
11. double input = 314159.26;
12. NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN);
13. String b;
14. //insert code here
Which code, inserted at line 14, sets the value of b to 314.159,26?
A.
b = nf.parse( input );
B.
b = nf.format( input );
C.
b = nf.equals( input );
D.
b = nf.parseObject( input );
Explanation:
A:
Main.java:14: cannot find symbol
symbol : method parse(double)
location: class java.text.NumberFormat
b = nf.parse( input );
^
1 errorB: 314.159,26
C:
Main.java:14: incompatible types
found : boolean
required: java.lang.String
b = nf.equals( input );
^
1 errorD:
Main.java:14: cannot find symbol
symbol : method parseObject(double)
location: class java.text.NumberFormat
b = nf.parseObject( input );
^
1 error