main.java
来自「java的经典例子」· Java 代码 · 共 25 行
JAVA
25 行
import java.text.ChoiceFormat;class Main { static public void main(String[] args) { // Create an empty choice format. ChoiceFormat form = new ChoiceFormat(""); // Define the integer ranges. double[] limits = {1,2,3,4,5,6,7}; // Define the strings that map to the ranges. String[] dayNames = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; // Apply the limits and dayNames. form.setChoices(limits, dayNames); // Format the number 2.5 double num = 2.5; // Format the number and print the result. System.out.print(form.format(num)); // "Mon" }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?