zoukankan      html  css  js  c++  java
  • java数据类型

    一、基本数据类型

      boolean  char   byte  short  int   long  float  double

      boolean   8位

      char     16位  0-2^16-1

      byte     8位   -2^7-2^7-1

      short   16位  -2^15-2^15-1

      int     32位  -2^31-2^31-1

      long     64位  -2^63-2^63-1

      float    32位  单精度浮点数 可以将byte short int long char 赋值给float,java会自动转换

      double   64位  

      short s1 = 1;s1 = s1 + 1;错误

      需要强制转换,如果是s1 = 1+1;就是正确。

      short s1 = 1;s1+=1;正确

      相当于s1 = (short)(s1+1);

     

  • 相关阅读:
    软件测试课堂练习1
    安卓增删改查
    安卓数据库表
    安卓注册登录
    安卓购物清单
    安卓计算器
    第四周安卓作业
    第七周作业
    jsp第六周
    第四次jsp作业
  • 原文地址:https://www.cnblogs.com/ckui/p/6092245.html
Copyright © 2011-2022 走看看