SCJP 1.6版考題 174

出自 陳富國維基館
於 2013年3月30日 (六) 02:01 由 Ikk (對話 | 貢獻) 所做的修訂 (新頁面: Given: 12. Date date = new Date(); 13. df.setLocale(Locale.ITALY); 14. String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in lin...)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
前往: 導覽搜尋
Given:
12. Date date = new Date();
13. df.setLocale(Locale.ITALY);
14. String s = df.format(date);
The variable df is an object of type DateFormat that has been initialized in line 11. 
What is the result if this code is run on December 14, 2000?
 A. The value of s is 14-dic-2000.
 B. The value of s is Dec 14, 2000.
 C. An exception is thrown at runtime.
 D. Compilation fails because of an error in line 13.

解答


Ans: D

解說: DateFormat類別沒有setLocale這個方法