This is some information on the Java 6 certification that I prepare. This information is not very well structured and it is most of the time an answer to the questions that come when I read the SCJP 6 book (Bates and Sierra). *** AS OF 5 OF MARCH 2010, I AM SCJP 6.0 ***

Monday, January 11, 2010

9 - Local conversions

public class Loc {

    static void Show() {
        Calendar c = Calendar.getInstance();
        c.set(2010, 11, 14);
        Date d2 = c.getTime();
        Locale LocaleDK = new Locale("da", "DK");
        Locale LocaleIT = new Locale("it", "IT");
        Locale LocaleFR = new Locale("fr", "FR");
        // In Italy we say danese !
        System.out.println("D>I:" + LocaleDK.getDisplayLanguage(LocaleIT));
        System.out.println("I>D:" + LocaleIT.getDisplayLanguage(LocaleDK)); // Italian in Danemark
        // LocalIT can translate "Italian" in ALL the languages
        System.out.println("D>F:" + LocaleDK.getDisplayLanguage(LocaleFR));
        // In Denmark we say French
        System.out.println("F>D:" + LocaleFR.getDisplayLanguage(LocaleDK));
    }
}


run:
D>I:danese
I>D:Italian
D>F:danois
F>D:French

No comments:

Post a Comment

Followers