Configuration.java Source code

Java tutorial

Introduction

Here is the source code for Configuration.java

Source

import java.util.ListResourceBundle;
import java.util.ResourceBundle;

class Configuration extends ListResourceBundle {
    protected Object[][] getContents() {
        return new Object[][] { { "port", 80 }, { "host", "java2s.com" }, { "protocol", "http" } };
    }
}

public class Main {
    public static void main(String[] args) {
        ResourceBundle resource = ResourceBundle.getBundle("your.ConfigFile");
        System.out.println(resource.getObject("port"));
        System.out.println(resource.getString("host"));
    }
}