MyResources.java Source code

Java tutorial

Introduction

Here is the source code for MyResources.java

Source

import java.util.*;

class MyResources extends ListResourceBundle {

    protected Object[][] getContents() {
        return new Object[][] { { "hello", "from java2s.com" }, { "client", "HTML" }, { "server", "PHP" } };
    }
}

public class Main {

    public static void main(String[] args) {

        MyResources mr = new MyResources();

        // print the string for key hello
        System.out.println(mr.getString("hello"));
    }
}