Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Locale;

public class Main {

    public static void main(String[] args) {
        Locale locale1 = new Locale("ENGLISH", "US");

        // print this locale
        System.out.println("Locale1:" + locale1);

        // create a second locale
        Locale locale2 = new Locale("GERMANY", "GERMAN");

        // compare two locales
        System.out.println("Locales are equal:" + locale1.equals(locale2));

        // create a third locale
        Locale locale3 = new Locale("ENGLISH", "US");

        // compare locale1 and locale3
        System.out.println("Locales are equal:" + locale1.equals(locale3));
    }
}