avatar
c*y
1
Integer i = new Integer (42);
Long 1 = new Long (42);
Double d = new Double (42.0);
Which two expressions evaluate to True? (Choose Two)
A. (i ==1)
B. (i == d)
C. (d == 1)
D. (i.equals (d))
E. (d.equals (i))
F. (i.equals (42))
请同时讲解一下,谢谢。
avatar
KG
2
Did you make up this problem. There are a few obvious syntatic errors...

【在 c****y 的大作中提到】
: Integer i = new Integer (42);
: Long 1 = new Long (42);
: Double d = new Double (42.0);
: Which two expressions evaluate to True? (Choose Two)
: A. (i ==1)
: B. (i == d)
: C. (d == 1)
: D. (i.equals (d))
: E. (d.equals (i))
: F. (i.equals (42))

avatar
c*y
3
我是在一个论坛里面看到的,里面也没说答案。为什么你说有错误?

【在 KG 的大作中提到】
: Did you make up this problem. There are a few obvious syntatic errors...
avatar
KG
4
For one, 42 is a primitive, not an Object, thus i.equals(42) is not valid.

【在 c****y 的大作中提到】
: 我是在一个论坛里面看到的,里面也没说答案。为什么你说有错误?
avatar
g*g
5
Very dumb question.
A, B, C, F will cause compilation error,
while D,E will output false.

【在 c****y 的大作中提到】
: Integer i = new Integer (42);
: Long 1 = new Long (42);
: Double d = new Double (42.0);
: Which two expressions evaluate to True? (Choose Two)
: A. (i ==1)
: B. (i == d)
: C. (d == 1)
: D. (i.equals (d))
: E. (d.equals (i))
: F. (i.equals (42))

avatar
e*g
6
why don't you just run it and see.

【在 c****y 的大作中提到】
: Integer i = new Integer (42);
: Long 1 = new Long (42);
: Double d = new Double (42.0);
: Which two expressions evaluate to True? (Choose Two)
: A. (i ==1)
: B. (i == d)
: C. (d == 1)
: D. (i.equals (d))
: E. (d.equals (i))
: F. (i.equals (42))

avatar
m*t
7

lol, that's probably the right answer.

【在 e***g 的大作中提到】
: why don't you just run it and see.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。