short float double
来源:互联网 发布:成杰老师的学而知不足 编辑:程序博客网 时间:2024/05/19 00:41
public void test() {// error// short s1 = 1; // s1 = s1 + 1; short s1 = 1; s1 += 1; System.out.println(s1);}
对于short s1 = 1; s1 = s1 + 1;由于s1+1运算时会自动提升表达式的类型,所以结果是int型,再赋值给short类型s1时,编译器将报告需要强制转换类型的错误。
对于short s1 = 1; s1 += 1;由于 +=是java语言规定的运算符,java编译器会对它进行特殊处理,因此可以正确编译。
public void test() {double d = 1.85;// errorfloat f = 2.8;// rightfloat f2 = 2.8f;}
- short float double
- short int、long、float、double
- short,int,float,long,double
- byte short int long float double
- char、short、int、long、char、float、double
- char short int long float double
- byte char short long float double理解
- short、int、long、long long, float、double、 long double
- java 彻底理解 byte char short int float long double
- java 彻底理解 byte char short int float long double
- Byte Short Integer Long Float Double类的使用
- char *(*(**(*(*(*x[5])(int,float))[][12])(double))(short,long))[][173] ???
- java 彻底理解 byte char short int float long double
- java 彻底理解 byte char short int float long double
- c语言基本数据类型short、int、long、char、float、double
- c语言基本数据类型short、int、long、char、float、double
- java:byte short int long float double char
- 数据类型计算效率,double ,int,long,short,float
- happy 界面画完了
- linux命令
- Packed-Decimal Format, Description and Discussion
- 推荐一系列优秀的Android开发源码
- Oracle ADDM 自动诊断监视工具 介绍
- short float double
- 大型JavaScript应用程序架构模式
- vs2008编译QT开源项目--太阳神三国杀源码分析(四) 动画
- iPhone/Mac Objective-C内存管理教程和原理剖析
- 负荷分担的可靠性系统仿真(中兴捧月任务四赛题)
- 世界名著100部简介
- GLSL 纹理贴图
- 使用Log4j进行日志操作
- 计算机领域世界顶尖学术期刊与会议论文