Question enthuware.ocpjp.v7.2.1192:
Posted: Mon Jun 13, 2016 10:17 am
How will you initialize a SimpleDateFormat object so that the following code will print the full text time zone of the given date?
System.out.println(sdf.format(new Date()));
A. SimpleDateFormat sdf = new SimpleDateFormat("tttt", Locale.FRANCE);
B. SimpleDateFormat sdf = new SimpleDateFormat("T", Locale.FRANCE);
C. SimpleDateFormat sdf = new SimpleDateFormat("z", Locale.FRANCE);
D. SimpleDateFormat sdf = new SimpleDateFormat("zzzz", Locale.FRANCE);
E. SimpleDateFormat sdf = new SimpleDateFormat("XXX", Locale.FRANCE);
The given answer is D, however, when I type in D in netbeans, it give me an compile error.
C is correct according to Netbeans. It prints out "CDT".
System.out.println(sdf.format(new Date()));
A. SimpleDateFormat sdf = new SimpleDateFormat("tttt", Locale.FRANCE);
B. SimpleDateFormat sdf = new SimpleDateFormat("T", Locale.FRANCE);
C. SimpleDateFormat sdf = new SimpleDateFormat("z", Locale.FRANCE);
D. SimpleDateFormat sdf = new SimpleDateFormat("zzzz", Locale.FRANCE);
E. SimpleDateFormat sdf = new SimpleDateFormat("XXX", Locale.FRANCE);
The given answer is D, however, when I type in D in netbeans, it give me an compile error.
C is correct according to Netbeans. It prints out "CDT".