⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 java的经典例子
💻 JAVA
字号:
import java.text.*;import java.util.Locale;class Main {    public static void main(String[] args) {        Locale[] locales = NumberFormat.getAvailableLocales();        NumberFormat numform = null;        DecimalFormat decform = null;        DecimalFormatSymbols sym = null;        int WIDTHCOL = 33;        int WIDTHCOL1 = 29;        for (int i = 0; i < locales.length; ++i) {            // Print out language and country names.            printAlignColumn(locales[i].getDisplayName(), WIDTHCOL);             // Get the number format for the locale.            numform = NumberFormat.getInstance(locales[i]);            // Cast the number format to a decimal format.            if (numform instanceof DecimalFormat) {                decform = (DecimalFormat)numform;                sym = decform.getDecimalFormatSymbols();                                                     //-- US Values --                print(sym.getZeroDigit());            //  0                print(sym.getGroupingSeparator());    //  ,                print(sym.getDecimalSeparator());     //  .                print(sym.getPerMill());              //  \u2030                print(sym.getPercent());              //  %                print(sym.getDigit());                //  #                print(sym.getPatternSeparator());     //  ;                print(sym.getInfinity());             //  \u221E                print(sym.getNaN());                  //  \uFFFD                print(sym.getMinusSign());            //  -                print("\n");            }        }    }    static void printAlignColumn(String str, int col) {        System.out.print(str);        for (int p = str.length(); p < col; ++p) {            System.out.print(" ");        }    }    static void print(char ch) {        System.out.print(ch);    }    static void print(String str) {        System.out.print(str);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -