SCJP程序员认证考试

单选题Given:   1.d is a valid, non-null Date object   2.df is a valid, non-null DateFormat object set to the current locale    What outputs the current locale’s country name and the appropriate version of d’s date?()A Locale loc = Locale.getLocale(); System.

题目
单选题
Given:   1.d is a valid, non-null Date object   2.df is a valid, non-null DateFormat object set to the current locale    What outputs the current locale’s country name and the appropriate version of d’s date?()
A

Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()+   + df.format(d));

B

Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()+   + df.format(d));

C

Locale loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+   + df.setDateFormat(d));

D

 Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+   + df.setDateFormat(d));

参考答案和解析
正确答案: D
解析: 暂无解析
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Which is not a valid locale definition file type?()

A. Language

B. Linguistic sort

C. Calendar

D. Territory

E. Character set


参考答案:C

第2题:

下列生成的Locale对象为汉语语种相关的是()

  • A、Locale locale=new Locale("ko","");
  • B、Locale locale=new Locale("ja","");
  • C、Locale locale=new Locale("en","US");
  • D、Locale locale=new Locale("zh","");
  • E、Locale locale=new Locale("es","");

正确答案:D

第3题:

Given:1.disavalid,non-nullDateobject2.dfisavalid,non-nullDateFormatobjectsettothecurrentlocaleWhatoutputsthecurrentlocale’scountrynameandtheappropriateversionofd’sdate?()

A.Localeloc=Locale.getLocale();System.out.println(loc.getDisplayCountry()+""+df.format(d));

B.Localeloc=Locale.getDefault();System.out.println(loc.getDisplayCountry()+""+df.format(d));

C.Localeloc=Locale.getLocale();System.out.println(loc.getDisplayCountry()+""+df.setDateFormat(d));

D.Localeloc=Locale.getDefault();System.out.println(loc.getDisplayCountry()+""+df.setDateFormat(d));


参考答案:B

第4题:

What is the name of the file that identifies the set of available locale definitions?()

  • A、 locale.def
  • B、 lxdef.ora
  • C、 lx1boot.nlb
  • D、 lx1boot.ora
  • E、 lang.def

正确答案:C

第5题:

Given:   1.d is a valid, non-null Date object   2.df is a valid, non-null DateFormat object set to the current locale    What outputs the current locale’s country name and the appropriate version of d’s date?()

  • A、Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()+ " " + df.format(d));
  • B、Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()+ " " + df.format(d));
  • C、Locale loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ " " + df.setDateFormat(d));
  • D、 Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+ " " + df.setDateFormat(d));

正确答案:B

第6题:

下列选项中不能能获得Locale实例是()

  • A、Locale locale=new Locale();
  • B、Locale locale=new Locale("ch","CH");
  • C、Locale locale=Locale.CHINA;
  • D、Locale locale =request.getLocale();

正确答案:A

第7题:

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-2004.
  • 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.

正确答案:D

第8题:

What is the name of the file that identifies the set of available locale definitions?()

A. locale.def

B. lxdef.ora

C. lx1boot.nlb

D. lx1boot.ora

E. lang.def


参考答案:C

第9题:

Which is not a valid locale definition file type?()

  • A、 Language
  • B、 Linguistic sort
  • C、 Calendar
  • D、 Territory
  • E、 Character set

正确答案:C

第10题:

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.

正确答案:D

更多相关问题