SCJP題庫第169題


Given:
12. NumberFormat nf = NumberFormat.getInstance();
13. nf.setMaximumFractionDigits(4);
14. nf.setMinimumFractionDigits(2);
15. String a = nf.format(3.1415926);
16. String b = nf.format(2);
Which two statements are true about The result if the default locale is Locale.US? (Choose two.)


A. The value of b is 2.
B. The value of a is 3.14.
C. The value of b is 2.00.
D. The value of a is 3.141.
E. The value of a is 3.1415.
F. The value of a is 3.1416.
G. The value of b is 2.0000.
Ans: CF
解說:
那二個敘述是真的? 預設的localeLocale.US
nf.setMaximumFractionDigits(4);
設定小數位置最大4位,若發生截位,則進行45入,如F
nf.setMinimumFractionDigits(2);
設定小數位置最小2位,如C

Comments

Popular posts from this blog

Android-使用webview在V3版的Google地圖GPS定位