zoukankan      html  css  js  c++  java
  • java 基本数据类型之四类八种

    四类

      整   型

      浮点型

      字符型

      布尔型

    八种

      整  型: byte  字节数  1  数据表示范围       默认值:0

              short                默认值:0

            int                 默认值:0

            long                默认值:0

      浮点型:float                默认值:0.0

          double               默认值:0.0

      字符型:char                默认值:u0000     注意  字符型和字符串(不属于基本类型)不一样

      布尔型:boolean              默认值:false

    引用数据类型 : string               默认值:null

     1 class Demo05 {
     2         byte a;
     3         int b;
     4         short c;
     5         long d;
     6         float e;
     7         double f;
     8         char g;
     9         String h;
    10         
    11     public static void main(String[] args) {
    12         Demo05 var = new Demo05();
    13         System.out.println(var.a);
    14         System.out.println(var.b);
    15         System.out.println(var.c);
    16         System.out.println(var.d);
    17         System.out.println(var.e);
    18         System.out.println(var.f);
    19         System.out.println(var.g);
    20         System.out.println(var.h);
    21 
    22     }
    23     
    24 }

     注意:要把char放最后,要不会有不显示

     

    整   型默认  是  int

    浮点型默认  是 double

  • 相关阅读:
    成为数据科学家并不难
    大数据分析的众包平台—Kaggle
    如何写一份好的数据分析报告
    配置java环境时,java的path地址放在其他地址的前面还是后面?
    js:随记
    JS:JSP Servlet
    [swustoj 1088] 德州扑克
    [swustoj 1092] 二分查找的最大次数
    [swustoj 371] 回文数
    [swustoj 1097] 2014
  • 原文地址:https://www.cnblogs.com/sunmoonyou/p/9309423.html
Copyright © 2011-2022 走看看