Home Tutorial Java Scjp Part12 SCJP Module-12 Question-3

 
 

Share on Google+Share on Google+
SCJP Module-12 Question-3
Posted on: July 20, 2010 at 12:00 AM
Advertisement
The Sample program given below will test your understanding about the Locale class of the Java.

Given  :

dd is non-null object of Date
datef is set to the current locale (non-null DateFormat object)

Which code lines outputs the current locale's country name and the appropriate version of dd's date?

1. Locale lc = Locale.getLocale();

   System.out.println(lc.getDisplayCountry()+ " " + datef.format(dd));

2. Locale lc = Locale.getDefault();

    System.out.println(lc.getDisplayCountry()+ " " + datef.format(dd));

3. Locale lc = Locale.getLocale();

    System.out.println(lc.getDisplayCountry()+ " " + datef.setDateFormat(dd));

4. Locale lc = Locale.getDefault();

    System.out.println(lc.getDisplayCountry() + " " + datef.setDateFormat(dd));

Answer

(2)

Advertisement

Related Tags for SCJP Module-12 Question-3:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 20, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com