Java.util.ListResourceBundle.handleGetObject()の使い方

Javaコード
package ListResourceBundle;

import java.util.ListResourceBundle;

//create a class that extends to ListResourceBundle
class OmoResources extends ListResourceBundle {

// get contents must be implemented
protected Object[][] getContents() {
return new Object[][]{
{“cftkey1", “検証データ1"},
{“cftkey2", “検証データ2"},
{“cftkey3", “検証データ3"}
};
}
}
public class handleGetObject {

public static void main(String[] args) {
// create a new OmoResources instance
OmoResources mr = new OmoResources();

// get the object for key hello
System.out.println(“" + mr.handleGetObject(“cftkey1"));
}

}

実行結果
検証データ1

Java

Posted by arkgame