?? choiceformatexam.java
字號:
import java.text.MessageFormat;
import java.text.ChoiceFormat;
public class ChoiceFormatExam
{
public static void main(String[] args) throws Exception
{
String pattern = "The disk \"{0}\" contains {1}.";
MessageFormat msgFmt = new MessageFormat(pattern);
double[] filelimits = {0, 1, 2};
String[] filepart = {"no files", "one file", "{1,number} files"};
ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
msgFmt.setFormatByArgumentIndex(1, fileform);
int fileCount = 100;
String diskName = "MyDisk";
Object[] testArgs = {diskName, new Long(fileCount)};
System.out.println(msgFmt.format(testArgs));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -