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

  • 相关阅读:
    C#可视化程序设计第三章(3,4)
    "Can’t be opened because Apple cannot check it for malicious software" 解决方案
    Mac系统.DS_Store文件导致IOError: [Errno 20] Not a directory:解决方案
    读书笔记 《局外人》
    Chrome 67之后无法离线安装插件
    函数和方法的区别
    github|webstorm
    webstorm
    Markdown
    github
  • 原文地址:https://www.cnblogs.com/sunmoonyou/p/9309423.html
Copyright © 2011-2022 走看看