集册 Java实例教程 使用原始数据类型

使用原始数据类型

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

580
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用原始数据类型

public class Main {  

  public static void main(String[] args) {/**来自 nowjava - 时代Java**/

    int anInt = 1;

    long aLong = 22200L;

    byte aByte = 65;

    short aShort = -02;

    char aChar = 'A';

    float aFloat = 1111.98F;

    double aDouble = 999.89;

    

    // Print values of the variables

    System.out.println("anInt = " + anInt);

    System.out.println("aLong = " + aLong);

    System.out.println("aByte = " + aByte);

    System.out.println("aShort = " + aShort);

    System.out.println("aChar = " + aChar);

    System.out.println("aFloat = " + aFloat);
    /*
     from N o w J a v a . c o m - 时  代  Java 
    */

    System.out.println("aDouble = " + aDouble);

    System.out.println("aDouble = " + aDouble);

    

    // Print sone double constants

    System.out.println("Max double = " + Double.MAX_VALUE);

    System.out.println("Min double = " + Double.MIN_VALUE);

    System.out.println("Positive infinity for double = " + Double.POSITIVE_INFINITY);

    System.out.println(
展开阅读全文