集册 Java实例教程 编写可读的数字文字

编写可读的数字文字

欢马劈雪     最近更新时间:2020-01-02 10:19:05

503
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
用下划线代替逗号或小数,以使其更具可读性。

public class Main {
/*
时 代 J     a    v  a - nowjava.com 提供
*/


    public static void main(String[] args) {

        int million = 1_000_000;

        int billion = 1_000_000_000;

        float ten_pct = 1_0f;

        double exp = 1_234_56.78_9e2;

        System.out.println(million);

        System.out.println(billion);

        System.out.println(ten_pct);

        System.out.println(exp);

    }

}