MessageFormat

public static void main(String[] args){
        String pattern = "hello {0}, 你好";
        String rt = MessageFormat.format(pattern, new Object[]{"world"});
        System.err.println(rt);
        String pattern1 = "日期 {1,date} 时间 {1,time} ,天气{0}";
        String rt1 = MessageFormat.format(pattern1, "晴朗",new Date());
        System.err.println(rt1);
    }

hello world, 你好java

日期 2014-12-30 时间 10:20:40 ,天气晴朗code

相关文章
相关标签/搜索