1
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