集册 Java实例教程 列出数据类型的最小值

列出数据类型的最小值

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

493
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
列出数据类型的最小值

public class MinVariablesDemo {//from 时 代 J a v a 公 众 号 - nowjava.com

    public static void main(String args[]) {


        // integers

        byte smallestByte = Byte.MIN_VALUE;

        short smallestShort = Short.MIN_VALUE;

        int smallestInteger = Integer.MIN_VALUE;

        long smallestLong = Long.MIN_VALUE;


        // real numbers

        float smallestFloat = Float.MIN_VALUE;

        double smallestDouble = Double.MIN_VALUE;


        // display them all

        System.out.println("The smallest byte value is " + smallestByte);

        System.out.println("The smallest short value is " + smallestShort);

        System.out.println("The smallest integer value is "

                + smallestInteger);

        System.out.println("The smallest long value is " + smallestLong);


        System.out.println("The smallest float value is " + smallestFloat);

        System.out
        /* 
         来自 
        *nowjava.com*/

                .println("The smallest double value is " + smallestDouble);

    }

}


展开阅读全文