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


Share on Google+Share on Google+
SCJP Module-12 Question-5
Posted on: July 20, 2010 at 12:00 AM
The Sample program will test your understanding about the Locale Class in Java.

Given below the sample code :

1  import java.text.*;
2  import java.util.*;
3  public class dateclass {
4  public static void main(String args[]){
5  Locale locale = Locale.getDefault();
6  System.out.println(locale);
7  // Insert code here
8  System.out.println(locale);
9  DateFormat df = DateFormat.getDateInstance();
10 Date myDate = new Date();
11 String myString = df.format(myDate);
12 System.out.println(myString);}}

What will be at line 7 to print date in locale of Canada(French) ?

1. locale = new Locale("fr", "CA");

2. df.setLocale(Locale.CA);

3. locale = new Locale("fr", "CA");

4. locale = new Locale("fr", "CA");





Related Tags for SCJP Module-12 Question-5:

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