MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class MainClass {
    public static void main(String args[]) throws Exception {
        ResourceBundle resources;

        try {
            resources = ResourceBundle.getBundle("MyData");
            System.out.println(resources.getString("Hi"));
        } catch (MissingResourceException mre) {
            System.err.println("MyData.properties not found");
        }
    }
}

//File: MyData.properties
/*
Hi = Hello World!
*/

//File: MyData_fr.properties
/*
Hi = Salut tout le monde!
*/