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);
答案:B
參考:11-4-1 NumberFormat類別
--------------------------------------------------------------
314.159,26 在義大利文裡,小數點是千分符號, 逗點是小數點, 跟一般常用相反.
nf取得ITALIAN格式後在 格式化.
沒有留言:
張貼留言