helloarg.java

来自「疯狂Java讲义_源码(含Java设计模式CHM」· Java 代码 · 共 26 行

JAVA
26
字号
import java.text.MessageFormat;
import java.text.DateFormat;
import java.text.Format;
import java.util.ResourceBundle;
import java.util.Locale;
import java.util.Date;

public class HelloArg
{
	public static void main(String[] args)
	{
        Locale currentLocale = null;
        if (args.length == 2)
        {
            currentLocale = new Locale(args[0] , args[1]);
        }
        else
        {
            currentLocale = Locale.getDefault();
        }
		ResourceBundle bundle = ResourceBundle.getBundle("MyResource" , currentLocale);
		String msg = bundle.getString("msg");		
		System.out.println(MessageFormat.format(msg , "yeeku" , new Date()));
	}	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?