Share on Google+Share on Google+

SCJP Module-12 Question-3

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));




Posted on: July 20, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null