java中byte、short、char、int的转换
来源:互联网 发布:身边的科学知作文250字 编辑:程序博客网 时间:2024/05/21 09:18
java中byte、short、 char和Int“字面值”之间可以不加强制类型转换,只要int类型的“字面值”不超过byte、short、char类型的范围。如:
byte i = 10(java中默认为int类型);可以转换;byte i = 128;不可以转换,128超出byte类型所能表示的范围,而如果int a = 10; byte b = a;也是不允许的;short、char类似。long和int如果要将long类型转换为int类型则必须要强制类型转换。如:int i = (int)1L;
byte、short、char之间计算不会互相转换,首先转换成int再计算。
boolean类型不能转换成其他类型。
容量小的类型会默认转换为容量大的类型:byte->short->int->long->float->double
将容量大的类型转换成容量小的类型需要进行强制转换。
- java中byte、short、char、int的转换
- byte、short、char和int的转换
- java中byte数组与int,long,short,float,char之间的转换
- java中byte数组与int,long,short,float,char之间的转换
- Java中byte数组与short,int,char,long,float,double之间的转换
- Java中byte数组与short,int,char,long,float,double之间的转换
- byte、short和char 隐式的转换为int
- byte、short和char隐式的转换为int
- java中byte,short,char,int,long运算
- java可以做switch case的只有int类型,和可以自动类型转换为int的byte, char,short
- Android中int,short,long和byte的转换
- C的无符号数据类型int,short,byte 转为 Java对应的数据long,char,short
- C的无符号数据类型int,short,byte 转为 Java对应的数据long,char,short
- C的无符号数据类型int,short,byte 转为 Java对应的数据long,char,short
- Java中有关byte和String的转换笔记和byte[]到short、int、long的相互转换
- int short byte转换
- byte[] int[] short[] 转换
- Java 语言中 short 与 byte[]之间的转换,int、long 类似。
- 抽象工厂模式lua实现
- Android高手进阶教程(十九)之---Android开发中,使用线程应该注意的问题!
- tomcat 启动失败,提示 Failed to initialize end point associated with ProtocolHandler
- win+R,命令集合
- Which type to use in Cpp
- java中byte、short、char、int的转换
- linux下查看网卡是否是混杂模式及ifconfig命令
- Exynos 4412开发板
- 通过一个链接,获取连接后内容
- Hadoop 2.0 HA安装时碰到的问题
- Oracle各个服务介绍
- php判断是否使用代理
- hdoj2837 Calculation (费马小定理+递归+欧拉函数)
- Android平台Airplay的实现方法