Object[] arguments = {
new Integer(7),
new Date(System.currentTimeMillis()),
"a disturbance in the Force"
}; String result = MessageFormat.format(
"At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
arguments); output: At 12:30 PM on Jul 3, 2053, there was a disturbance
in the Force on planet 7.time,date,number 表示按何种格式显示,0,1,2表示数组中的序号(下标)。
new Integer(7),
new Date(System.currentTimeMillis()),
"a disturbance in the Force"
}; String result = MessageFormat.format(
"At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
arguments); output: At 12:30 PM on Jul 3, 2053, there was a disturbance
in the Force on planet 7.time,date,number 表示按何种格式显示,0,1,2表示数组中的序号(下标)。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货