📄 main.java
字号:
import java.text.ChoiceFormat;class Main { static public void main(String[] args) { // Create a choice format using that pattern. ChoiceFormat form = new ChoiceFormat(""); // Create the pattern string. String pattern = "1.0#Sun|2.0#Mon|3.0#Tue|4.0#Wed|5.0#Thu|6.0#Fri|7.0#Sat"; // Apply the pattern. form.applyPattern(pattern); // Diagnostics - iterate over the arrays. for (int i = 0; i < form.getFormats().length; i++) { // Get the formats. System.out.print((form.getFormats())[i] + " "); // Get the limits. System.out.println((form.getLimits())[i]); } // Format the number 2.5 double num = 2.5; // Format the number and print the result. System.out.println("\n" + form.format(num)); // "Mon" }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -