一组涉及java基础和计组的例题,试试你能答出几个
2021-01-29 20:26
标签:read == integer int lang -- code lan 计组 一组涉及java基础和计组的例题,试试你能答出几个 标签:read == integer int lang -- code lan 计组 原文地址:https://www.cnblogs.com/INnoVationv2/p/12822632.html1
int a = 50;
Integer a1 = 50;
Integer b1 = 50;
Integer c1 = 100;
Integer d1 = a1 + b1;
a == a1;
a == b1;
a1 == b1;
c1 == a1 + b1;
c1 == d1;
2.
int a = 100;
Integer a1 = 100;
Integer b1 = 100;
Integer c1 = 200;
Integer d1 = a1 + b1;
a == a1;
a == b1;
a1 == b1;
c1 == a1 + b1;
c1 == d1;
3.
int a = 200;
Integer a1 = 200;
Integer b1 = 200;
Integer c1 = 400;
Integer d1 = a1 + b1;
a == a1;
a == b1;
a1 == b1;
c1 == a1 + b1;
c1 == d1;
4.
double a = 50d;
Double a1 = 50d;
Double b1 = 50d;
Double c1 = 100d;
Double d1 = a1 + b1;
a == a1;
a == b1;
a1 == b1;
c1 == a1 + b1;
c1 == d1;
5.
double a = 200d;
Double a1 = 200d;
Double b1 = 200d;
Double c1 = 400d;
Double d1 = a1 + b1;
a == a1;
a == b1;
a1 == b1;
c1 == a1 + b1;
c1 == d1;
6.
double a = 0.1d;
double b = 0.2d;
double c = 0.3d;
c == a + b;
0.3d == a + b;
7.
float a = 0.1f;
float b = 0.2f;
double c = 0.3f;
c == a + b;
0.3f == a + b;
8.
int a = 0;
int b = 0;
a / b;
9.
double a = 0d;
double b = 0d;
a / b;
答案
---------t1----------
true
true
true
true
true
---------t2----------
true
true
true
true
false
---------t3----------
true
true
false
true
false
---------t4----------
true
true
false
true
false
---------t5----------
true
true
false
true
false
---------t6----------
false
false
---------t7----------
true
true
---------t9----------
NaN
---------t8----------
Exception in thread "main" java.lang.ArithmeticException: / by zero
下一篇:Java自动装箱与缓存
文章标题:一组涉及java基础和计组的例题,试试你能答出几个
文章链接:http://soscw.com/index.php/essay/48841.html