Advertisement
JeffGrigg

Internationalized HelloWorld program

Jan 19th, 2019
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.47 KB | None | 0 0
  1. import java.util.ResourceBundle;
  2.  
  3. public class HelloWorld2 {
  4.     public static void main(String[] args) {
  5.         final String messageBundleName = HelloWorld2.class.getPackage().getName().replace('.', '/') + "/MessagesBundle";
  6.         final ResourceBundle messagesBundle = ResourceBundle.getBundle(messageBundleName);
  7.         final String genericGreetingMessage = messagesBundle.getString("generic.greeting.message");
  8.         System.out.println(genericGreetingMessage);
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement